Skip to content

Commit

Permalink
Removed incorrect NOTREACHED in typedom
Browse files Browse the repository at this point in the history
The NOTREACHED triggered when accessing shorthands in attributeStyleMap
for elements without a style attribute.

Bug: 1290995
Change-Id: Ia2888db8959ce1350246337b704cc44a50eaccde
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3416193
Reviewed-by: Xiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/main@{#963768}
  • Loading branch information
Rune Lillesveen authored and chromium-wpt-export-bot committed Jan 26, 2022
1 parent f70d614 commit ed1f565
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
11 changes: 11 additions & 0 deletions css/css-typed-om/resources/testhelper.js
Expand Up @@ -144,6 +144,17 @@ function createDivWithStyle(test, cssText) {
return element;
}

// Creates a new div element without inline style.
// The created element is deleted during test cleanup.
function createDivWithoutStyle(test) {
let element = document.createElement('div');
document.body.appendChild(element);
test.add_cleanup(() => {
element.remove();
});
return element;
}

// Creates a new div element with inline style |cssText| and returns
// its inline style property map.
function createInlineStyleMap(test, cssText) {
Expand Down
Expand Up @@ -27,4 +27,10 @@
}, 'Getting a shorthand property that is partially set in inline style ' +
'returns null');

test(t => {
const styleMap = createDivWithoutStyle(t).attributeStyleMap;
assert_equals(styleMap.get('margin'), null,
'Shorthand value must be null for element without style');
}, 'Getting an attributeStyleMap shorthand property from an element without ' +
'a style attribute');
</script>

0 comments on commit ed1f565

Please sign in to comment.