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

Unified Diff: third_party/WebKit/Source/core/html/HTMLElement.cpp

Issue 2707973002: Remove blacklist on .innerHTML and .outerHTML (Closed)
Patch Set: Typo fix Created 3 years, 10 months 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: third_party/WebKit/Source/core/html/HTMLElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLElement.cpp b/third_party/WebKit/Source/core/html/HTMLElement.cpp
index 69d1fc0537bfa0aa545342e1c9574c66fb19a3f2..39b55319ae3d3d4a1cfe1a2686c8996a538d63d1 100644
--- a/third_party/WebKit/Source/core/html/HTMLElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLElement.cpp
@@ -136,24 +136,17 @@ String HTMLElement::nodeName() const {
return Element::nodeName();
}
-bool HTMLElement::ieForbidsInsertHTML() const {
- // FIXME: Supposedly IE disallows settting innerHTML, outerHTML
- // and createContextualFragment on these tags. We have no tests to
- // verify this however, so this list could be totally wrong.
- // This list was moved from the previous endTagRequirement() implementation.
- // This is also called from editing and assumed to be the list of tags
- // for which no end tag should be serialized. It's unclear if the list for
- // IE compat and the list for serialization sanity are the same.
+bool HTMLElement::shouldSerializeEndTag() const {
+ // See https://www.w3.org/TR/DOM-Parsing/
if (hasTagName(areaTag) || hasTagName(baseTag) || hasTagName(basefontTag) ||
- hasTagName(brTag) || hasTagName(colTag) || hasTagName(embedTag) ||
- hasTagName(frameTag) || hasTagName(hrTag) || hasTagName(imageTag) ||
+ hasTagName(bgsoundTag) || hasTagName(brTag) || hasTagName(colTag) ||
+ hasTagName(embedTag) || hasTagName(frameTag) || hasTagName(hrTag) ||
hasTagName(imgTag) || hasTagName(inputTag) || hasTagName(keygenTag) ||
- hasTagName(linkTag) || (RuntimeEnabledFeatures::contextMenuEnabled() &&
- hasTagName(menuitemTag)) ||
- hasTagName(metaTag) || hasTagName(paramTag) || hasTagName(sourceTag) ||
- hasTagName(trackTag) || hasTagName(wbrTag))
- return true;
- return false;
+ hasTagName(linkTag) || hasTagName(menuitemTag) || hasTagName(metaTag) ||
+ hasTagName(paramTag) || hasTagName(sourceTag) || hasTagName(trackTag) ||
+ hasTagName(wbrTag))
+ return false;
+ return true;
}
static inline CSSValueID unicodeBidiAttributeForDirAuto(HTMLElement* element) {
@@ -507,29 +500,8 @@ DocumentFragment* HTMLElement::textToFragment(const String& text,
return fragment;
}
-static inline bool shouldProhibitSetInnerOuterText(const HTMLElement& element) {
- return element.hasTagName(colTag) || element.hasTagName(colgroupTag) ||
- element.hasTagName(framesetTag) || element.hasTagName(headTag) ||
- element.hasTagName(htmlTag) || element.hasTagName(tableTag) ||
- element.hasTagName(tbodyTag) || element.hasTagName(tfootTag) ||
- element.hasTagName(theadTag) || element.hasTagName(trTag);
-}
-
void HTMLElement::setInnerText(const String& text,
ExceptionState& exceptionState) {
- if (ieForbidsInsertHTML()) {
- exceptionState.throwDOMException(
- NoModificationAllowedError,
- "The '" + localName() + "' element does not support text insertion.");
- return;
- }
- if (shouldProhibitSetInnerOuterText(*this)) {
- exceptionState.throwDOMException(
- NoModificationAllowedError,
- "The '" + localName() + "' element does not support text insertion.");
- return;
- }
-
// FIXME: This doesn't take whitespace collapsing into account at all.
if (!text.contains('\n') && !text.contains('\r')) {
@@ -567,19 +539,6 @@ void HTMLElement::setInnerText(const String& text,
void HTMLElement::setOuterText(const String& text,
ExceptionState& exceptionState) {
- if (ieForbidsInsertHTML()) {
- exceptionState.throwDOMException(
- NoModificationAllowedError,
- "The '" + localName() + "' element does not support text insertion.");
- return;
- }
- if (shouldProhibitSetInnerOuterText(*this)) {
- exceptionState.throwDOMException(
- NoModificationAllowedError,
- "The '" + localName() + "' element does not support text insertion.");
- return;
- }
-
ContainerNode* parent = parentNode();
if (!parent) {
exceptionState.throwDOMException(NoModificationAllowedError,
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLElement.h ('k') | third_party/WebKit/Source/web/WebFrameSerializerImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698