Skip to content
This repository has been archived by the owner on Sep 20, 2019. It is now read-only.

Commit

Permalink
Merge pull request #160 from azakus/wrap-ownersvgelement
Browse files Browse the repository at this point in the history
Wrap SVGElement.ownerSVGElement
  • Loading branch information
dfreedm committed Jan 21, 2015
2 parents 37c2e94 + cd3fe52 commit 7d1e0d8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/ShadowDOM/wrappers/SVGElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
var Element = scope.wrappers.Element;
var HTMLElement = scope.wrappers.HTMLElement;
var registerObject = scope.registerObject;
var defineWrapGetter = scope.defineWrapGetter;

var SVG_NS = 'http://www.w3.org/2000/svg';
var svgTitleElement = document.createElementNS(SVG_NS, 'title');
Expand All @@ -30,5 +31,7 @@
delete Element.prototype.classList;
}

defineWrapGetter(SVGElement, 'ownerSVGElement');

scope.wrappers.SVGElement = SVGElement;
})(window.ShadowDOMPolyfill);
13 changes: 13 additions & 0 deletions tests/ShadowDOM/js/SVGElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,17 @@ suite('SVGElement', function() {
}
});

test('ownerSVGElement', function() {
var el = document.createElementNS(SVG_NS, 'svg');
var el2 = document.createElementNS(SVG_NS,'svg');
var g = document.createElementNS(SVG_NS, 'g');
el.appendChild(g);

assert.equal(g.ownerSVGElement, el);

el2.appendChild(g);

assert.equal(g.ownerSVGElement, el2);
});

});

0 comments on commit 7d1e0d8

Please sign in to comment.