Re:Vanilla JS, fast, lightweight, cross-platform framework
by v413 on Sunday August 26, 2012 @03:00PM
(#4435897)
The right way is this :)
Array.prototype.forEach.call(document.getElementsByTagName('p'), function(el) { el.innerHTML = 'Hello.'; });
Re:Vanilla JS, fast, lightweight, cross-platform framework
by dasil003 on Sunday August 26, 2012 @08:00PM
(#4436741)
I like how the end of that statement contains both a winking crooked-smile smiley next to black-eyed frown smiley.
Re:Vanilla JS, fast, lightweight, cross-platform framework
by Skalman on Sunday August 26, 2012 @02:57PM
(#4435880)
Nope:
TypeError: document.getElementsByTagName("p").filter is not a function
Because you don't get an array, only something array-like.
ps. second example is not valid, in Vanilla JS you do it like this: