mirror of
https://github.com/jlengrand/webcomponentsjs.git
synced 2026-03-10 08:51:22 +00:00
Merge remote-tracking branch 'upstream/master' into relative_path_resolving_in_css
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "webcomponentsjs",
|
||||
"main": "webcomponents.js",
|
||||
"version": "0.5.1-1",
|
||||
"version": "0.5.3",
|
||||
"homepage": "http://webcomponents.org",
|
||||
"authors": [
|
||||
"The Polymer Authors"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "webcomponents.js",
|
||||
"version": "0.5.1-1",
|
||||
"version": "0.5.3",
|
||||
"description": "webcomponents.js",
|
||||
"main": "gulpfile.js",
|
||||
"directories": {
|
||||
|
||||
@@ -62,7 +62,7 @@ Object.defineProperty(rootDocument, '_currentScript', currentScriptDescriptor);
|
||||
Add support for the `HTMLImportsLoaded` event and the `HTMLImports.whenReady`
|
||||
method. This api is necessary because unlike the native implementation,
|
||||
script elements do not force imports to resolve. Instead, users should wrap
|
||||
code in either an `HTMLImportsLoaded` hander or after load time in an
|
||||
code in either an `HTMLImportsLoaded` handler or after load time in an
|
||||
`HTMLImports.whenReady(callback)` call.
|
||||
|
||||
NOTE: This module also supports these apis under the native implementation.
|
||||
|
||||
@@ -15,7 +15,7 @@ var isIE = scope.isIE;
|
||||
|
||||
/*
|
||||
NOTE: Even when native HTMLImports exists, the following api is available by
|
||||
loading the polyfill. This provides api compabitility where the polyfill
|
||||
loading the polyfill. This provides api compatibility where the polyfill
|
||||
cannot be "correct":
|
||||
|
||||
* `document._currentScript`
|
||||
|
||||
@@ -242,7 +242,13 @@
|
||||
'querySelectorAll',
|
||||
'removeChild',
|
||||
'replaceChild',
|
||||
].concat(matchesNames));
|
||||
]);
|
||||
|
||||
forwardMethodsToWrapper([
|
||||
window.HTMLBodyElement,
|
||||
window.HTMLHeadElement,
|
||||
window.HTMLHtmlElement,
|
||||
], matchesNames);
|
||||
|
||||
forwardMethodsToWrapper([
|
||||
window.HTMLDocument || window.Document, // Gecko adds these to HTMLDocument
|
||||
|
||||
@@ -692,7 +692,7 @@
|
||||
n = nodes[i];
|
||||
if (n.nodeType === Node.TEXT_NODE) {
|
||||
if (!modNode && !n.data.length)
|
||||
this.removeNode(n);
|
||||
this.removeChild(n);
|
||||
else if (!modNode)
|
||||
modNode = n;
|
||||
else {
|
||||
|
||||
@@ -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');
|
||||
@@ -30,5 +31,7 @@
|
||||
delete Element.prototype.classList;
|
||||
}
|
||||
|
||||
defineWrapGetter(SVGElement, 'ownerSVGElement');
|
||||
|
||||
scope.wrappers.SVGElement = SVGElement;
|
||||
})(window.ShadowDOMPolyfill);
|
||||
|
||||
@@ -53,6 +53,11 @@ htmlSuite('Document', function() {
|
||||
assert.equal(doc.head.parentNode, doc.documentElement);
|
||||
});
|
||||
|
||||
test('document.matches', function() {
|
||||
var doc = wrap(document);
|
||||
assert.isTrue(doc.matches === undefined);
|
||||
});
|
||||
|
||||
test('getElementsByTagName', function() {
|
||||
var elements = document.getElementsByTagName('body');
|
||||
assert.isTrue(elements instanceof HTMLCollection);
|
||||
|
||||
@@ -416,6 +416,25 @@ suite('Node', function() {
|
||||
assert.equal(div.childNodes.length, 3);
|
||||
});
|
||||
|
||||
test('normalize - issue 145', function() {
|
||||
var div = document.createElement('div');
|
||||
div.appendChild(document.createTextNode(''));
|
||||
div.appendChild(document.createTextNode(''));
|
||||
div.appendChild(document.createTextNode(''));
|
||||
var childDiv = document.createElement('div');
|
||||
childDiv.appendChild(document.createTextNode(''));
|
||||
childDiv.appendChild(document.createTextNode(''));
|
||||
div.appendChild(childDiv);
|
||||
|
||||
assert.equal(div.childNodes.length, 4);
|
||||
assert.equal(childDiv.childNodes.length, 2);
|
||||
|
||||
div.normalize();
|
||||
|
||||
assert.equal(div.childNodes.length, 1);
|
||||
assert.equal(childDiv.childNodes.length, 0);
|
||||
});
|
||||
|
||||
test('appendChild last and first', function() {
|
||||
var a = document.createElement('a');
|
||||
a.innerHTML = '<b></b>';
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user