| 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 * (C) 2007 David Smith (catfish.man@gmail.com) | 6 * (C) 2007 David Smith (catfish.man@gmail.com) |
| 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. | 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. |
| 8 * (C) 2007 Eric Seidel (eric@webkit.org) | 8 * (C) 2007 Eric Seidel (eric@webkit.org) |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1157 if (other->elementData()) | 1157 if (other->elementData()) |
| 1158 return other->elementData()->isEquivalent(elementData()); | 1158 return other->elementData()->isEquivalent(elementData()); |
| 1159 return true; | 1159 return true; |
| 1160 } | 1160 } |
| 1161 | 1161 |
| 1162 String Element::nodeName() const | 1162 String Element::nodeName() const |
| 1163 { | 1163 { |
| 1164 return m_tagName.toString(); | 1164 return m_tagName.toString(); |
| 1165 } | 1165 } |
| 1166 | 1166 |
| 1167 void Element::setPrefix(const AtomicString& prefix, ExceptionState& exceptionSta
te) | |
| 1168 { | |
| 1169 UseCounter::countDeprecation(document(), UseCounter::ElementSetPrefix); | |
| 1170 | |
| 1171 if (!prefix.isEmpty() && !Document::isValidName(prefix)) { | |
| 1172 exceptionState.throwDOMException(InvalidCharacterError, "The prefix '" +
prefix + "' is not a valid name."); | |
| 1173 return; | |
| 1174 } | |
| 1175 | |
| 1176 // FIXME: Raise NamespaceError if prefix is malformed per the Namespaces in
XML specification. | |
| 1177 | |
| 1178 const AtomicString& nodeNamespaceURI = namespaceURI(); | |
| 1179 if (nodeNamespaceURI.isEmpty() && !prefix.isEmpty()) { | |
| 1180 exceptionState.throwDOMException(NamespaceError, "No namespace is set, s
o a namespace prefix may not be set."); | |
| 1181 return; | |
| 1182 } | |
| 1183 | |
| 1184 if (prefix == xmlAtom && nodeNamespaceURI != XMLNames::xmlNamespaceURI) { | |
| 1185 exceptionState.throwDOMException(NamespaceError, "The prefix '" + xmlAto
m + "' may not be set on namespace '" + nodeNamespaceURI + "'."); | |
| 1186 return; | |
| 1187 } | |
| 1188 | |
| 1189 if (exceptionState.hadException()) | |
| 1190 return; | |
| 1191 | |
| 1192 m_tagName.setPrefix(prefix.isEmpty() ? AtomicString() : prefix); | |
| 1193 } | |
| 1194 | |
| 1195 const AtomicString& Element::locateNamespacePrefix(const AtomicString& namespace
ToLocate) const | 1167 const AtomicString& Element::locateNamespacePrefix(const AtomicString& namespace
ToLocate) const |
| 1196 { | 1168 { |
| 1197 if (!prefix().isNull() && namespaceURI() == namespaceToLocate) | 1169 if (!prefix().isNull() && namespaceURI() == namespaceToLocate) |
| 1198 return prefix(); | 1170 return prefix(); |
| 1199 | 1171 |
| 1200 AttributeCollection attributes = this->attributes(); | 1172 AttributeCollection attributes = this->attributes(); |
| 1201 for (const Attribute& attr : attributes) { | 1173 for (const Attribute& attr : attributes) { |
| 1202 if (attr.prefix() == xmlnsAtom && attr.value() == namespaceToLocate) | 1174 if (attr.prefix() == xmlnsAtom && attr.value() == namespaceToLocate) |
| 1203 return attr.localName(); | 1175 return attr.localName(); |
| 1204 } | 1176 } |
| (...skipping 2065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3270 return wrapper; | 3242 return wrapper; |
| 3271 | 3243 |
| 3272 CustomElementBinding* binding = perContextData->customElementBinding(customE
lementDefinition()); | 3244 CustomElementBinding* binding = perContextData->customElementBinding(customE
lementDefinition()); |
| 3273 | 3245 |
| 3274 wrapper->SetPrototype(binding->prototype()); | 3246 wrapper->SetPrototype(binding->prototype()); |
| 3275 | 3247 |
| 3276 return V8DOMWrapper::associateObjectWithWrapper(isolate, this, wrapperType,
wrapper); | 3248 return V8DOMWrapper::associateObjectWithWrapper(isolate, this, wrapperType,
wrapper); |
| 3277 } | 3249 } |
| 3278 | 3250 |
| 3279 } // namespace blink | 3251 } // namespace blink |
| OLD | NEW |