Bug 1134981 - Quick fix in registerElement. r=bz

This commit is contained in:
Gabor Krizsanits 2015-02-26 15:20:37 +01:00
parent 0886b2b1e0
commit 7a1bf4bafe
3 changed files with 3 additions and 8 deletions

View File

@ -6348,15 +6348,12 @@ nsDocument::RegisterElement(JSContext* aCx, const nsAString& aType,
// Make sure that the element name matches the name in the definition.
// (e.g. a definition for x-button extending button should match
// <button is="x-button"> but not <x-button>.
// Note: we also check the tag name, because if it's not the above
// mentioned case, it can be that only the |is| property has been
// changed, which we should ignore by the spec.
if (elem->NodeInfo()->NameAtom() != nameAtom &&
elem->Tag() == nameAtom) {
if (elem->Tag() != nameAtom) {
//Skip over this element because definition does not apply.
continue;
}
MOZ_ASSERT(elem->IsHTML(nameAtom));
nsWrapperCache* cache;
CallQueryInterface(elem, &cache);
MOZ_ASSERT(cache, "Element doesn't support wrapper cache?");

View File

@ -88,7 +88,7 @@ par.removeChild(del);
del.setAttribute("is", "foobar");
par.appendChild(del);
is(getComputedStyle(del).color, "rgb(0, 0, 255)", "del - color (after reappend)");
var Del = document.registerElement('x-del', { prototype: Object.create(HTMLSpanElement.prototype) });
var Del = document.registerElement('x-del', { extends: 'span', prototype: Object.create(HTMLSpanElement.prototype) });
// [is="x-del"] will not match any longer so the rule of span will apply
is(getComputedStyle(del).color, "rgb(0, 255, 0)", "del - color (after registerElement)");
// but the element should have been upgraded:

View File

@ -9,6 +9,4 @@
[Test custom element type after changing IS attribute value. Element is HTML5 element with IS attribute referring to custom element type]
expected: FAIL
[Custom element type must be taken from the local name of the element even if IS attribute provided. There\'s no definition for the value of IS attribute at first]
expected: FAIL