Skip to content

Commit

Permalink
fix contains BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
qincheng committed Oct 3, 2014
1 parent 18b7e72 commit c4c421b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions avalon.modern.js
Expand Up @@ -176,9 +176,6 @@
slice: function(nodes, start, end) {
return aslice.call(nodes, start, end)
},
contains: function(a, b) {
return a.contains(b)
},
eventHooks: {},
bind: function(el, type, fn, phase) {
var hooks = avalon.eventHooks
Expand Down Expand Up @@ -301,6 +298,16 @@
return !!(this.compareDocumentPosition(arg) & 16)
}
}
avalon.contains = function(a, b) {
if (b) {
while ((b = b.parentNode)) {
if (b === a) {
return true;
}
}
}
return false
}
if (window.SVGElement) {
var svgns = "http://www.w3.org/2000/svg"
var svg = document.createElementNS(svgns, "svg")
Expand Down

0 comments on commit c4c421b

Please sign in to comment.