This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 22711 - Add a .empty method to the ParentNode (or the Node?) interface
Summary: Add a .empty method to the ParentNode (or the Node?) interface
Status: RESOLVED DUPLICATE of bug 17426
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: DOM (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Anne
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-17 09:50 UTC by David Bruant
Modified: 2014-02-12 20:10 UTC (History)
4 users (show)

See Also:


Attachments

Description David Bruant 2013-07-17 09:50:41 UTC
Pretty much the standard equivalent of http://api.jquery.com/empty/
Currently, one has to do something like:
  element.innerHTML = '';
Comment 1 Anne 2013-07-17 13:54:22 UTC
What's wrong with .textContent = ""? See also bug 17426 and http://krijnhoetmer.nl/irc-logs/whatwg/20120605#l-780
Comment 2 David Bruant 2013-07-28 11:06:27 UTC
(In reply to comment #1)
> What's wrong with .textContent = ""?
As much as there is something wrong with node.parentNode.removeChild(node). It's doesn't say what it means.
Not everyone is expert enough in the DOM aware of the textContent="" trick and some people just traverse all childNodes to remove them one by one.


> See also bug 17426 and
> http://krijnhoetmer.nl/irc-logs/whatwg/20120605#l-780
I'm not sure I understand what I should be seeing there. People seem to agree, no? (I'll let others debate on the chaining aspect, I just want the .empty())
Comment 3 Anne 2014-02-12 20:10:12 UTC

*** This bug has been marked as a duplicate of bug 17426 ***