| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>Position value 'sticky' should be a valid value</title> |
| 3 <link rel="help" href="https://www.w3.org/TR/css-position-3/#position-property"
/> |
| 4 <meta name="assert" content="This test checks that setting position to 'sticky' |
| 5 should be allowed." /> |
| 6 |
| 7 <script src="/resources/testharness.js"></script> |
| 8 <script src="/resources/testharnessreport.js"></script> |
| 9 |
| 10 <!-- We need something to create elements in. --> |
| 11 <body></body> |
| 12 |
| 13 <script> |
| 14 // Sticky is valid for all elements except table-column-group and table-column. |
| 15 const VALID_STICKY_DISPLAY_TYPES = [ |
| 16 'block', |
| 17 'inline', |
| 18 'run-in', |
| 19 'flow', |
| 20 'flow-root', |
| 21 'table', |
| 22 'flex', |
| 23 'grid', |
| 24 'ruby', |
| 25 'subgrid', |
| 26 'list-item', |
| 27 'table-row-group', |
| 28 'table-header-group', |
| 29 'table-footer-group', |
| 30 'table-row', |
| 31 'table-cell', |
| 32 'table-caption', |
| 33 'ruby-base', |
| 34 'ruby-text', |
| 35 'ruby-base-container', |
| 36 'ruby-text-container', |
| 37 'contents', |
| 38 'none', |
| 39 ]; |
| 40 |
| 41 const INVALID_STICKY_DISPLAY_TYPES = [ |
| 42 'table-column-group', |
| 43 'table-column', |
| 44 ]; |
| 45 |
| 46 test(() => { |
| 47 for (displayValue of VALID_STICKY_DISPLAY_TYPES) { |
| 48 let div = document.createElement('div'); |
| 49 let style = `position: sticky; display: ${displayValue};`; |
| 50 div.setAttribute('style', style); |
| 51 document.body.appendChild(div); |
| 52 |
| 53 // We only check display values that the browser under test recognizes. |
| 54 if (div.style.display == displayValue) { |
| 55 assert_equals(getComputedStyle(div).position, 'sticky', |
| 56 `Expected sticky to be valid for display: ${displayValue}`); |
| 57 } |
| 58 document.body.removeChild(div); |
| 59 } |
| 60 |
| 61 for (displayValue of INVALID_STICKY_DISPLAY_TYPES) { |
| 62 let div = document.createElement('div'); |
| 63 let style = `position: sticky; display: ${displayValue};`; |
| 64 div.setAttribute('style', style); |
| 65 document.body.appendChild(div); |
| 66 |
| 67 assert_not_equals(getComputedStyle(div).position, 'sticky', |
| 68 `Expected sticky to be invalid for display: ${displayValue}`); |
| 69 document.body.removeChild(div); |
| 70 } |
| 71 }, 'The value of sticky for the position property should be parsed correctly'); |
| 72 </script> |
| 73 |
| OLD | NEW |