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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 void DatasetDOMStringMap::setItem(const String& name, const String& value, Excep tionState& exceptionState) 181 void DatasetDOMStringMap::setItem(const String& name, const String& value, Excep tionState& exceptionState)
182 { 182 {
183 if (!isValidPropertyName(name)) { 183 if (!isValidPropertyName(name)) {
184 exceptionState.throwDOMException(SyntaxError, ExceptionMessages::failedT oSet(name, "DOMStringMap", "'" + name + "' is not a valid property name.")); 184 exceptionState.throwDOMException(SyntaxError, ExceptionMessages::failedT oSet(name, "DOMStringMap", "'" + name + "' is not a valid property name."));
185 return; 185 return;
186 } 186 }
187 187
188 m_element->setAttribute(convertPropertyNameToAttributeName(name), value, exc eptionState); 188 m_element->setAttribute(convertPropertyNameToAttributeName(name), value, exc eptionState);
189 } 189 }
190 190
191 void DatasetDOMStringMap::deleteItem(const String& name, ExceptionState& excepti onState) 191 bool DatasetDOMStringMap::deleteItem(const String& name)
192 { 192 {
193 if (!isValidPropertyName(name)) { 193 if (isValidPropertyName(name)) {
194 exceptionState.throwDOMException(SyntaxError, ExceptionMessages::failedT oDelete(name, "DOMStringMap", "'" + name + "' is not a valid property name.")); 194 String attributeName = convertPropertyNameToAttributeName(name);
195 return; 195 if (m_element->hasAttribute(attributeName)) {
196 m_element->removeAttribute(attributeName);
197 return true;
198 }
196 } 199 }
197 200 return false;
198 m_element->removeAttribute(convertPropertyNameToAttributeName(name));
199 } 201 }
200 202
201 } // namespace WebCore 203 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698