开发者

dojo.query not working for attribute selector that includes a tilde (~) character

开发者 https://www.devze.com 2022-12-17 02:38 出处:网络
I need to select a link node given its url. Using an attribute selector works quite well except for a few rare cases when the url has a tilda. I have no control over the link urls. Here is an example:

I need to select a link node given its url. Using an attribute selector works quite well except for a few rare cases when the url has a tilda. I have no control over the link urls. Here is an example:

<script>
dojo.ready(function() {
    var node = dojo.query('a[href="http://abc.com/~123"]')[0];
    console.debug(node);
    node = dojo.query('a[href="http://abc.com/_123"]')[0];
    console.debug(node);
});
</script>
...
<body>
    <a href="http://abc.com/~123">link 1&lt;/a>
    <a href="http://abc.com/_123">link 2&lt;/a>
</body>

This prints:

undef开发者_StackOverflow中文版ined
<a href="http://abc.com/_123">

I looked at the level 3 selectors spec and didn't find anything on the tilde character being unsupported for attribute selector values which are just CSS strings.

Help!


This appears to have been fixed in 1.6 http://bugs.dojotoolkit.org/ticket/10651

0

精彩评论

暂无评论...
验证码 换一张
取 消