Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Merge pull request #350 from arv/svg-tag-name
Browse files Browse the repository at this point in the history
Fix issue with Element not having all the required properties
  • Loading branch information
dfreedm committed Jan 15, 2014
2 parents 42d24b8 + 309442d commit a9ec396
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/wrappers/Element.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
mixin(Element.prototype, ParentNodeInterface);
mixin(Element.prototype, SelectorsInterface);

registerWrapper(OriginalElement, Element);
registerWrapper(OriginalElement, Element, document.createElement(null, 'x'));

// TODO(arv): Export setterDirtiesAttribute and apply it to more bindings
// that reflect attributes.
Expand Down
57 changes: 57 additions & 0 deletions test/js/SVGElement.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright 2014 The Polymer Authors. All rights reserved.
* Use of this source code is goverened by a BSD-style
* license that can be found in the LICENSE file.
*/

suite('SVGElement', function() {

var SVG_NS = 'http://www.w3.org/2000/svg';

test('Basics', function() {
var el = document.createElementNS(SVG_NS, 'svg');

assert.equal(el.localName, 'svg');
assert.equal(el.tagName, 'svg');
assert.equal(el.namespaceURI, SVG_NS);
assert.instanceOf(el, SVGElement);
assert.instanceOf(el, Element);
assert.instanceOf(el, Node);
assert.instanceOf(el, EventTarget);
assert.notInstanceOf(el, HTMLElement);
});

test('Basics innerHTML', function() {
var div = document.createElement('div');
div.innerHTML = '<svg></svg>';
var el = div.firstChild;

assert.equal(el.localName, 'svg');
assert.equal(el.tagName, 'svg');
assert.equal(el.namespaceURI, SVG_NS);
assert.instanceOf(el, SVGElement);
assert.instanceOf(el, Element);
assert.instanceOf(el, Node);
assert.instanceOf(el, EventTarget);
assert.notInstanceOf(el, HTMLElement);
});

test('template', function() {
var el = document.createElementNS(SVG_NS, 'template');

assert.equal(el.localName, 'template');
assert.equal(el.tagName, 'template');
assert.equal(el.namespaceURI, SVG_NS);

// IE does not create an SVGElement if the local name is not a known SVG
// element.
if (!/Trident/.test(navigator.userAgent))
assert.instanceOf(el, SVGElement);

assert.instanceOf(el, Element);
assert.instanceOf(el, Node);
assert.instanceOf(el, EventTarget);
assert.notInstanceOf(el, HTMLElement);
});

});
1 change: 1 addition & 0 deletions test/test.main.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ var modules = [
'Node.js',
'ParentNodeInterface.js',
'Range.js',
'SVGElement.js',
'SVGElementInstance.js',
'ShadowRoot.js',
'Text.js',
Expand Down

0 comments on commit a9ec396

Please sign in to comment.