1description("Test to make sure EntityReference nodes are always treated readonly") 2 3var xmlDoc = document.implementation.createDocument("http://www.w3.org/1999/xhtml", "html", null); 4var xmlDoc2 = document.implementation.createDocument("http://www.w3.org/1999/xhtml", "html", null); 5var entityReference = xmlDoc.createEntityReference("gt"); 6 7shouldThrow("xmlDoc2.adoptNode(entityReference)"); 8shouldBe("entityReference.ownerDocument", "xmlDoc") 9 10// nodeValue is defined to be null for Entity Reference nodes, and thus should silently fail to modify 11// Spec is ambigious as to if we should throw here or not. I've requested clarification: 12// http://lists.w3.org/Archives/Public/www-dom/2008JanMar/0009.html 13shouldThrow("entityReference.nodeValue = 'foo'"); 14shouldBe("entityReference.nodeValue", "null"); 15 16shouldThrow("entityReference.prefix = 'foo'"); 17shouldBe("entityReference.prefix", "null"); 18 19shouldThrow("entityReference.textContent = 'foo'"); 20shouldBe("entityReference.textContent", "'>'"); 21 22var childrenBeforeFailedAppend = entityReference.childNodes.length; 23shouldBe("childrenBeforeFailedAppend", "1"); 24var text = document.createTextNode("FAIL"); 25shouldThrow("entityReference.appendChild(text)"); 26shouldBe("entityReference.childNodes.length", "childrenBeforeFailedAppend"); 27 28childrenBeforeFailedAppend = entityReference.childNodes.length; 29shouldBe("childrenBeforeFailedAppend", "1"); 30shouldThrow("entityReference.insertBefore(text, entityReference.firstChild)"); 31shouldBe("entityReference.childNodes.length", "childrenBeforeFailedAppend"); 32 33var successfullyParsed = true; 34