OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Peter Kelly (pmk@post.com) | 4 * (C) 2001 Peter Kelly (pmk@post.com) |
5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights
reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights
reserved. |
7 * (C) 2007 Eric Seidel (eric@webkit.org) | 7 * (C) 2007 Eric Seidel (eric@webkit.org) |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 return m_element->getAttributeNode(name); | 52 return m_element->getAttributeNode(name); |
53 } | 53 } |
54 | 54 |
55 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::getNamedItemNS(const AtomicString& na
mespaceURI, const AtomicString& localName) const | 55 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::getNamedItemNS(const AtomicString& na
mespaceURI, const AtomicString& localName) const |
56 { | 56 { |
57 return m_element->getAttributeNodeNS(namespaceURI, localName); | 57 return m_element->getAttributeNodeNS(namespaceURI, localName); |
58 } | 58 } |
59 | 59 |
60 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::removeNamedItem(const AtomicString& n
ame, ExceptionState& exceptionState) | 60 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::removeNamedItem(const AtomicString& n
ame, ExceptionState& exceptionState) |
61 { | 61 { |
62 size_t index = m_element->hasAttributes() ? m_element->getAttributeItemIndex
(name, m_element->shouldIgnoreAttributeCase()) : kNotFound; | 62 size_t index = m_element->hasAttributes() ? m_element->findAttributeIndexByN
ame(name, m_element->shouldIgnoreAttributeCase()) : kNotFound; |
63 if (index == kNotFound) { | 63 if (index == kNotFound) { |
64 exceptionState.throwDOMException(NotFoundError, "No item with name '" +
name + "' was found."); | 64 exceptionState.throwDOMException(NotFoundError, "No item with name '" +
name + "' was found."); |
65 return nullptr; | 65 return nullptr; |
66 } | 66 } |
67 return m_element->detachAttribute(index); | 67 return m_element->detachAttribute(index); |
68 } | 68 } |
69 | 69 |
70 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::removeNamedItemNS(const AtomicString&
namespaceURI, const AtomicString& localName, ExceptionState& exceptionState) | 70 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::removeNamedItemNS(const AtomicString&
namespaceURI, const AtomicString& localName, ExceptionState& exceptionState) |
71 { | 71 { |
72 size_t index = m_element->hasAttributes() ? m_element->getAttributeItemIndex
(QualifiedName(nullAtom, localName, namespaceURI)) : kNotFound; | 72 size_t index = m_element->hasAttributes() ? m_element->findAttributeIndexByN
ame(QualifiedName(nullAtom, localName, namespaceURI)) : kNotFound; |
73 if (index == kNotFound) { | 73 if (index == kNotFound) { |
74 exceptionState.throwDOMException(NotFoundError, "No item with name '" +
namespaceURI + "::" + localName + "' was found."); | 74 exceptionState.throwDOMException(NotFoundError, "No item with name '" +
namespaceURI + "::" + localName + "' was found."); |
75 return nullptr; | 75 return nullptr; |
76 } | 76 } |
77 return m_element->detachAttribute(index); | 77 return m_element->detachAttribute(index); |
78 } | 78 } |
79 | 79 |
80 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::setNamedItem(Node* node, ExceptionSta
te& exceptionState) | 80 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::setNamedItem(Node* node, ExceptionSta
te& exceptionState) |
81 { | 81 { |
82 if (!node) { | 82 if (!node) { |
(...skipping 12 matching lines...) Expand all Loading... |
95 | 95 |
96 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::setNamedItemNS(Node* node, ExceptionS
tate& exceptionState) | 96 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::setNamedItemNS(Node* node, ExceptionS
tate& exceptionState) |
97 { | 97 { |
98 return setNamedItem(node, exceptionState); | 98 return setNamedItem(node, exceptionState); |
99 } | 99 } |
100 | 100 |
101 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::item(unsigned index) const | 101 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::item(unsigned index) const |
102 { | 102 { |
103 if (index >= length()) | 103 if (index >= length()) |
104 return nullptr; | 104 return nullptr; |
105 return m_element->ensureAttr(m_element->attributeItem(index).name()); | 105 return m_element->ensureAttr(m_element->attributeAt(index).name()); |
106 } | 106 } |
107 | 107 |
108 size_t NamedNodeMap::length() const | 108 size_t NamedNodeMap::length() const |
109 { | 109 { |
110 if (!m_element->hasAttributes()) | 110 if (!m_element->hasAttributes()) |
111 return 0; | 111 return 0; |
112 return m_element->attributeCount(); | 112 return m_element->attributeCount(); |
113 } | 113 } |
114 | 114 |
115 void NamedNodeMap::trace(Visitor* visitor) | 115 void NamedNodeMap::trace(Visitor* visitor) |
116 { | 116 { |
117 visitor->trace(m_element); | 117 visitor->trace(m_element); |
118 } | 118 } |
119 | 119 |
120 } // namespace WebCore | 120 } // namespace WebCore |
OLD | NEW |