Repository navigation
Expand file tree
/
Copy pathident-function-parsing.html
More file actions
42 lines (37 loc) · 1.84 KB
/
Copy pathident-function-parsing.html
File metadata and controls
42 lines (37 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!DOCTYPE html>
<title>CSS Values: The ident() Function (parsing)</title>
<link rel="help" href="https://drafts.csswg.org/css-values-5/#ident">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
<script>
// Any property that accepts <custom-ident> will do.
let prop = 'view-transition-name';
// ident() is an arbitrary substitution function, so only its argument grammar is validated at parse
// time: ident( <declaration-value> ). The argument is parsed as <ident-arg>+ at computed-value time.
// https://github.com/w3c/csswg-drafts/issues/14213
test_invalid_value(prop, 'ident()');
test_invalid_value(prop, 'ident( )');
test_invalid_value(prop, 'ident({})');
test_invalid_value(prop, 'ident(a, b)');
// Not an <ident-arg>+, so these are valid here and invalid at computed-value time.
test_valid_value(prop, 'ident(rgb(1, 2, 3))');
test_valid_value(prop, 'ident(5px)');
// The argument round-trips as specified, with no whitespace normalization.
test_valid_value(prop, 'ident(myident)');
test_valid_value(prop, 'ident( myident)');
test_valid_value(prop, 'ident(myident )');
test_valid_value(prop, 'ident("myident")');
test_valid_value(prop, 'ident("myident" 3)');
test_valid_value(prop, 'ident(3 "myident")');
test_valid_value(prop, 'ident("my" "ident")');
test_valid_value(prop, 'ident(my "ident")');
test_valid_value(prop, 'ident("my" ident)');
test_valid_value(prop, 'ident(my ident)');
test_valid_value(prop, 'ident(-- myident)');
test_valid_value(prop, 'ident(my 3 3 3 3 ident)')
// Check for support in specific properties (WIP):
let ident = 'ident("myident" 42)';
// https://drafts.csswg.org/css-view-transitions/#view-transition-name-prop
test_valid_value('view-transition-name', ident);
</script>