amccollum/sel — Issue #3: Handle byId selectors on detached fragments
Author: rvagg
Created: 2011-12-12 08:11:34+00:00
State: open

```js
var e = document.createElement('p');
e.innerHTML = '';
console.log(sel.sel('#aa', e)); // -> []
document.body.appendChild(e);
console.log(sel.sel('#aa')); // -> [​​]
```

Because a detached fragment still has an `ownerDocument`, i.e. the document your called `createElement()` on, but because it's detached, calling `root.ownerDocument.getElementById('aa')` won't return the element. I had to use the `'[id="aa"]'` selector rewrite to get this to work in Qwery, tho at @ded hasn't merged the fix yet: https://github.com/rvagg/qwery/blob/07b36ce7ac6b3b71d4870b130d54ed0125ab00bf/src/qwery.js#L248

I don't really want to have a go at fixing this one myself, I haven't fully got my head around enough of Sel yet.