Inner packaging of the prototype
2 answers
The prototype wrap
does work on text nodes, but it doesn't say it clearly and doesn't expand text nodes in the usual way. Also, the selector $$
excludes inline text nodes, so you'll need to load them yourself.
var h3 = $$('h3').first(),
text = h3.childNodes.first();
Element.wrap(text, 'a', { href: '#' });
+1
source to share