mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 12:49:19 +00:00
LibWeb: Use length() getter in CharacterData algorithms
Closer matching spec text, as well as pre-existing use in CharacterData::substring_data. This helps in porting of this file over to new String which has no length member function.
This commit is contained in:
parent
e8f14f8cd0
commit
b2f3aa1c76
Notes:
sideshowbarker
2024-07-17 07:31:31 +09:00
Author: https://github.com/shannonbooth
Commit: b2f3aa1c76
Pull-request: https://github.com/SerenityOS/serenity/pull/21024
Reviewed-by: https://github.com/AtkinsSJ ✅
1 changed files with 2 additions and 2 deletions
|
@ -33,7 +33,7 @@ void CharacterData::set_data(DeprecatedString data)
|
||||||
// NOTE: Since the offset is 0, it can never be above data's length, so this can never throw.
|
// NOTE: Since the offset is 0, it can never be above data's length, so this can never throw.
|
||||||
// NOTE: Setting the data to the same value as the current data still causes a mutation observer callback.
|
// NOTE: Setting the data to the same value as the current data still causes a mutation observer callback.
|
||||||
// FIXME: Figure out a way to make this a no-op again if the passed in data is the same as the current data.
|
// FIXME: Figure out a way to make this a no-op again if the passed in data is the same as the current data.
|
||||||
MUST(replace_data(0, m_data.length(), data));
|
MUST(replace_data(0, this->length(), data));
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#concept-cd-substring
|
// https://dom.spec.whatwg.org/#concept-cd-substring
|
||||||
|
@ -124,7 +124,7 @@ WebIDL::ExceptionOr<void> CharacterData::replace_data(size_t offset, size_t coun
|
||||||
WebIDL::ExceptionOr<void> CharacterData::append_data(DeprecatedString const& data)
|
WebIDL::ExceptionOr<void> CharacterData::append_data(DeprecatedString const& data)
|
||||||
{
|
{
|
||||||
// The appendData(data) method steps are to replace data with node this, offset this’s length, count 0, and data data.
|
// The appendData(data) method steps are to replace data with node this, offset this’s length, count 0, and data data.
|
||||||
return replace_data(m_data.length(), 0, data);
|
return replace_data(this->length(), 0, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#dom-characterdata-insertdata
|
// https://dom.spec.whatwg.org/#dom-characterdata-insertdata
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue