From 853b72ed7a426ecb0d0233ccac1c5871262d6afa Mon Sep 17 00:00:00 2001 From: andycall Date: Fri, 11 Aug 2023 23:29:56 +0800 Subject: [PATCH] fix: fix set Element.style.cssText API. --- .../core/css/inline_css_style_declaration.cc | 4 ++++ .../cssom/cssom-setCssText-serialize.html | 23 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 integration_tests/specs/cssom/cssom-setCssText-serialize.html diff --git a/bridge/core/css/inline_css_style_declaration.cc b/bridge/core/css/inline_css_style_declaration.cc index 20d291ae79..716c5c494d 100644 --- a/bridge/core/css/inline_css_style_declaration.cc +++ b/bridge/core/css/inline_css_style_declaration.cc @@ -74,6 +74,10 @@ ScriptValue InlineCssStyleDeclaration::item(const AtomicString& key, ExceptionSt bool InlineCssStyleDeclaration::SetItem(const AtomicString& key, const ScriptValue& value, ExceptionState& exception_state) { + if (IsPrototypeMethods(key)) { + return false; + } + std::string propertyName = key.ToStdString(ctx()); return InternalSetProperty(propertyName, value.ToLegacyDOMString()); } diff --git a/integration_tests/specs/cssom/cssom-setCssText-serialize.html b/integration_tests/specs/cssom/cssom-setCssText-serialize.html new file mode 100644 index 0000000000..e18cd420d2 --- /dev/null +++ b/integration_tests/specs/cssom/cssom-setCssText-serialize.html @@ -0,0 +1,23 @@ + + + + CSSOM Parsing Test: getting cssText must return the result of serializing the CSS declaration blocks. + + + + + + + +
+
+ + + \ No newline at end of file