mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Auto merge of #14365 - canaltinova:block-important, r=emilio
Property declaration block serialization should check for importance <!-- Please describe your changes on the following line: --> r? @emilio , @Manishearth --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #14329 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14365) <!-- Reviewable:end -->
This commit is contained in:
commit
a0269027db
4 changed files with 76 additions and 6 deletions
|
@ -39677,6 +39677,12 @@
|
|||
"deleted_reftests": {},
|
||||
"items": {
|
||||
"testharness": {
|
||||
"cssom/shorthand-serialization.html": [
|
||||
{
|
||||
"path": "cssom/shorthand-serialization.html",
|
||||
"url": "/cssom/shorthand-serialization.html"
|
||||
}
|
||||
],
|
||||
"html/semantics/forms/form-submission-0/submit-entity-body.html": [
|
||||
{
|
||||
"path": "html/semantics/forms/form-submission-0/submit-entity-body.html",
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Shorthand serialization should be done correctly.</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="foo1" style="background: red;">foo</div>
|
||||
<div id="foo2" style="background-color: blue; background: red !important; background-color: green;">foo</div>
|
||||
<div id="foo3" style="background-color: blue; background: red; background-color: green !important;">foo</div>
|
||||
|
||||
<div id="foo4" style="margin-right: 10px; margin-left: 10px; margin-top: 10px; margin-bottom: 10px;">foo</div>
|
||||
<div id="foo5" style="margin-right: 10px; margin-left: 10px; margin-top: 10px; margin-bottom: 10px!important;">foo</div>
|
||||
<div id="foo6" style="margin-right: 10px !important; margin-left: 10px !important; margin-top: 10px !important; margin-bottom: 10px!important;">foo</div>
|
||||
|
||||
<script>
|
||||
test(function() {
|
||||
var elem1 = document.getElementById('foo1');
|
||||
var elem2 = document.getElementById('foo2');
|
||||
var elem3 = document.getElementById('foo3');
|
||||
|
||||
assert_false(elem1.style.cssText.endsWith('!important;'));
|
||||
assert_true(elem2.style.cssText.endsWith('!important;'));
|
||||
assert_false(elem3.style.background.endsWith('!important'));
|
||||
|
||||
}, "Shorthand serialization with shorthand and longhands mixed.");
|
||||
|
||||
test(function() {
|
||||
var elem4 = document.getElementById('foo4');
|
||||
var elem5 = document.getElementById('foo5');
|
||||
var elem6 = document.getElementById('foo6');
|
||||
|
||||
assert_equals(elem4.style.cssText, 'margin: 10px;');
|
||||
assert_equals(elem4.style.margin, '10px');
|
||||
assert_equals(elem5.style.cssText, 'margin-right: 10px; margin-left: 10px; margin-top: 10px; margin-bottom: 10px !important;');
|
||||
assert_equals(elem5.style.margin, '');
|
||||
assert_equals(elem6.style.cssText, 'margin: 10px !important;');
|
||||
assert_equals(elem6.style.margin, '10px');
|
||||
}, "Shorthand serialization with just longhands.");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue