Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(535)

Unified Diff: Source/core/dom/DatasetDOMStringMap.cpp

Issue 106853005: Implement platform deleters per spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Switch to DeleteResult enum + extend scheme to indexed deleters Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/DatasetDOMStringMap.cpp
diff --git a/Source/core/dom/DatasetDOMStringMap.cpp b/Source/core/dom/DatasetDOMStringMap.cpp
index 921531948ca49d0f372263ce1972af4b43334950..f9cd4eec6d78473b65a590e135e358bb7f7c5228 100644
--- a/Source/core/dom/DatasetDOMStringMap.cpp
+++ b/Source/core/dom/DatasetDOMStringMap.cpp
@@ -188,14 +188,16 @@ void DatasetDOMStringMap::setItem(const String& name, const String& value, Excep
m_element->setAttribute(convertPropertyNameToAttributeName(name), value, exceptionState);
}
-void DatasetDOMStringMap::deleteItem(const String& name, ExceptionState& exceptionState)
+bool DatasetDOMStringMap::deleteItem(const String& name)
{
- if (!isValidPropertyName(name)) {
- exceptionState.throwDOMException(SyntaxError, ExceptionMessages::failedToDelete(name, "DOMStringMap", "'" + name + "' is not a valid property name."));
- return;
+ if (isValidPropertyName(name)) {
+ String attributeName = convertPropertyNameToAttributeName(name);
+ if (m_element->hasAttribute(attributeName)) {
+ m_element->removeAttribute(attributeName);
+ return true;
+ }
}
-
- m_element->removeAttribute(convertPropertyNameToAttributeName(name));
+ return false;
}
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698