views:

223

answers:

0

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</a>
    <a href="http://abc.com/_123">link 2</a>
</body>

This prints:

  undefined
  <a href="http://abc.com/_123">`

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

Help!