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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 return m_element->setAttributeNode(toAttr(node), exceptionState); | 92 return m_element->setAttributeNode(toAttr(node), exceptionState); |
93 } | 93 } |
94 | 94 |
95 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::setNamedItemNS(Node* node, ExceptionS
tate& exceptionState) | 95 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::setNamedItemNS(Node* node, ExceptionS
tate& exceptionState) |
96 { | 96 { |
97 return setNamedItem(node, exceptionState); | 97 return setNamedItem(node, exceptionState); |
98 } | 98 } |
99 | 99 |
100 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::item(unsigned index) const | 100 PassRefPtrWillBeRawPtr<Node> NamedNodeMap::item(unsigned index) const |
101 { | 101 { |
102 if (index >= length()) | 102 if (!m_element->hasAttributes()) |
103 return nullptr; | 103 return nullptr; |
104 return m_element->ensureAttr(m_element->attributeAt(index).name()); | 104 AttributeCollection attributes = m_element->attributes(); |
| 105 if (index >= attributes.size()) |
| 106 return nullptr; |
| 107 return m_element->ensureAttr(attributes[index].name()); |
105 } | 108 } |
106 | 109 |
107 size_t NamedNodeMap::length() const | 110 size_t NamedNodeMap::length() const |
108 { | 111 { |
109 if (!m_element->hasAttributes()) | 112 if (!m_element->hasAttributes()) |
110 return 0; | 113 return 0; |
111 return m_element->attributeCount(); | 114 return m_element->attributes().size(); |
112 } | 115 } |
113 | 116 |
114 void NamedNodeMap::trace(Visitor* visitor) | 117 void NamedNodeMap::trace(Visitor* visitor) |
115 { | 118 { |
116 visitor->trace(m_element); | 119 visitor->trace(m_element); |
117 } | 120 } |
118 | 121 |
119 } // namespace WebCore | 122 } // namespace WebCore |
OLD | NEW |