1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 22:07:34 +00:00

LibWeb: Fix regression of "contenteditable" attribute

This commit is contained in:
TheFightingCatfish 2021-07-31 18:14:58 +08:00 committed by Andreas Kling
parent 95331ea864
commit 08359ba578
3 changed files with 5 additions and 5 deletions

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html contenteditable="true"> <html>
<head> <head>
<title>Welcome!</title> <title>Welcome!</title>

View file

@ -34,12 +34,12 @@ HTMLElement::ContentEditableState HTMLElement::content_editable_state() const
{ {
auto contenteditable = attribute(HTML::AttributeNames::contenteditable); auto contenteditable = attribute(HTML::AttributeNames::contenteditable);
// "true", an empty string or a missing value map to the "true" state. // "true", an empty string or a missing value map to the "true" state.
if (contenteditable.is_empty() || contenteditable.equals_ignoring_case("true")) if ((!contenteditable.is_null() && contenteditable.is_empty()) || contenteditable.equals_ignoring_case("true"))
return ContentEditableState::True; return ContentEditableState::True;
// "false" maps to the "false" state. // "false" maps to the "false" state.
if (contenteditable.equals_ignoring_case("false")) if (contenteditable.equals_ignoring_case("false"))
return ContentEditableState::False; return ContentEditableState::False;
// An invalid value maps to the "inherit" state. // Having no such attribute or an invalid value maps to the "inherit" state.
return ContentEditableState::Inherit; return ContentEditableState::Inherit;
} }

View file

@ -40,9 +40,9 @@ public:
struct Attribute { struct Attribute {
String prefix; String prefix;
String local_name; String local_name { "" };
String namespace_; String namespace_;
String value; String value { "" };
Position name_start_position; Position name_start_position;
Position value_start_position; Position value_start_position;
Position name_end_position; Position name_end_position;