@@ -32,11 +32,11 @@ class Node {
3232 }
3333 get nextSibling ( ) {
3434 let p = this . parentNode ;
35- if ( p ) return p . childNodes [ findWhere ( p . childNodes , this , true ) + 1 ] ;
35+ if ( p ) return p . childNodes [ findWhere ( p . childNodes , this , true , true ) + 1 ] ;
3636 }
3737 get previousSibling ( ) {
3838 let p = this . parentNode ;
39- if ( p ) return p . childNodes [ findWhere ( p . childNodes , this , true ) - 1 ] ;
39+ if ( p ) return p . childNodes [ findWhere ( p . childNodes , this , true , true ) - 1 ] ;
4040 }
4141 get firstChild ( ) {
4242 return this . childNodes [ 0 ] ;
@@ -51,7 +51,8 @@ class Node {
5151 insertBefore ( child , ref ) {
5252 child . remove ( ) ;
5353 child . parentNode = this ;
54- ! ref ? this . childNodes . push ( child ) : splice ( this . childNodes , ref , child ) ;
54+ if ( ref ) splice ( this . childNodes , ref , child , true ) ;
55+ else this . childNodes . push ( child ) ;
5556 return child ;
5657 }
5758 replaceChild ( child , ref ) {
@@ -62,7 +63,7 @@ class Node {
6263 }
6364 }
6465 removeChild ( child ) {
65- splice ( this . childNodes , child ) ;
66+ splice ( this . childNodes , child , false , true ) ;
6667 return child ;
6768 }
6869 remove ( ) {
@@ -114,23 +115,23 @@ class Element extends Node {
114115 }
115116
116117 setAttributeNS ( ns , name , value ) {
117- let attr = findWhere ( this . attributes , createAttributeFilter ( ns , name ) ) ;
118+ let attr = findWhere ( this . attributes , createAttributeFilter ( ns , name ) , false , false ) ;
118119 if ( ! attr ) this . attributes . push ( attr = { ns, name } ) ;
119120 attr . value = String ( value ) ;
120121 }
121122 getAttributeNS ( ns , name ) {
122- let attr = findWhere ( this . attributes , createAttributeFilter ( ns , name ) ) ;
123+ let attr = findWhere ( this . attributes , createAttributeFilter ( ns , name ) , false , false ) ;
123124 return attr && attr . value ;
124125 }
125126 removeAttributeNS ( ns , name ) {
126- splice ( this . attributes , createAttributeFilter ( ns , name ) ) ;
127+ splice ( this . attributes , createAttributeFilter ( ns , name ) , false , false ) ;
127128 }
128129
129130 addEventListener ( type , handler ) {
130131 ( this . __handlers [ toLower ( type ) ] || ( this . __handlers [ toLower ( type ) ] = [ ] ) ) . push ( handler ) ;
131132 }
132133 removeEventListener ( type , handler ) {
133- splice ( this . __handlers [ toLower ( type ) ] , handler , 0 , true ) ;
134+ splice ( this . __handlers [ toLower ( type ) ] , handler , false , true ) ;
134135 }
135136 dispatchEvent ( event ) {
136137 let t = event . target = this ,
@@ -195,7 +196,7 @@ class Event {
195196 */
196197export default function createDocument ( ) {
197198 let document = new Document ( ) ;
198- assign ( document , document . defaultView = { document, Document, Node, Text, Element, SVGElement :Element , Event } ) ;
199+ assign ( document , document . defaultView = { document, Document, Node, Text, Element, SVGElement : Element , Event } ) ;
199200 document . appendChild (
200201 document . documentElement = document . createElement ( 'html' )
201202 ) ;
0 commit comments