$$('p', $('article')) returns all <p> elements in the first <article>, not all <p>s that are children of <article>s. For that you'd still have to do $$("article > p")
HTMLElement.prototype.has = HTMLElement.prototype.hasAttribute doesn't bind the function properly, so this will not work properly
your .text() function should use .textContent not .innerText
HTMLElement.append should still check to see if child is an instance of Node, even if it's not an HTMLElement
Same with HTMLElement.prototype.prepend
Also HTMLElement.prototype.prepend, already exists
HTMLElement.prototype.remove already exists too
HTMLElement.prototype.parent should return .parentElement
HTMLElement.prototype.emit should have args=null as a parameter and use new CustomEvent(event, { detail:args })
Pellentesque nec neque ex. Aliquam at quam vitae lacus convallis pulvinar. Mauris vitae ullamcorper lacus. Cras nisi dui, faucibus non dolor quis, volutpat euismod massa. Donec et pulvinar erat.
Some notes:
$$('p', $('article'))
returns all<p>
elements in the first<article>
, not all<p>
s that are children of<article>
s. For that you'd still have to do$$("article > p")
HTMLElement.prototype.has = HTMLElement.prototype.hasAttribute
doesn't bind the function properly, sothis
will not work properly.text()
function should use.textContent
not.innerText
HTMLElement.append
should still check to see ifchild
is an instance ofNode
, even if it's not anHTMLElement
HTMLElement.prototype.prepend
HTMLElement.prototype.prepend
, already existsHTMLElement.prototype.remove
already exists tooHTMLElement.prototype.parent
should return.parentElement
HTMLElement.prototype.emit
should haveargs=null
as a parameter and usenew CustomEvent(event, { detail:args })
HTMLElement.prototype.append
andNodeList.prototype.forEach
already exist, too.Thanks I fixed the things you said in updated gist. Why does text need to return textContent and not innerText?
innerText
is a lot more performance heavy and triggers layout to be recalculated.stackoverflow.com/a/35213639/5203655
AFAIK,
innerText
is also non-standard (originally IE-only) whereastextContent
is part of the standard.