Skip to content

Commit 9b934d4

Browse files
committed
Add Element.prototype.remove() from DOM4.
1 parent 29e839e commit 9b934d4

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/lib/elementprototype.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1-
if (!Element.prototype.contains)
1+
// From DOM4
2+
// http://www.w3.org/TR/dom/#dom-childnode-remove
3+
if (!Element.prototype.remove)
4+
{
5+
Element.prototype.remove = function()
6+
{
7+
if (this.parentNode)
8+
this.parentNode.removeChild(this);
9+
};
10+
}
11+
12+
if (!Element.prototype.contains)
213
{
314
Element.prototype.contains = function(ele)
415
{

0 commit comments

Comments
 (0)