Code example for Element

Methods: getAttributeNode, setAttribute, setIdAttribute

0
        assertFalse(vitaminc.getAttributeNode("name").isId());
        assertNull(document.getElementById("c"));
    } 
 
    public void testMultipleIdsOnOneElement() { 
        vitaminc.setAttribute("name", "c");
        vitaminc.setIdAttribute("name", true);
        vitaminc.setAttribute("atc", "a11g");
        vitaminc.setIdAttribute("atc", true);
 
        assertTrue(vitaminc.getAttributeNode("name").isId());
        assertTrue(vitaminc.getAttributeNode("atc").isId());
        assertSame(vitaminc, document.getElementById("c"));
        assertSame(vitaminc, document.getElementById("a11g"));
        assertNull(document.getElementById("g"));
    } 
 
    @KnownFailure("Dalvik treats id attributes as identifiers") 
    public void testAttributeNamedIdIsNotAnIdByDefault() { 
        String message = "This implementation incorrectly interprets the "
                + "\"id\" attribute as an identifier by default.";