-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.html
87 lines (66 loc) · 1.98 KB
/
demo.html
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!doctype html>
<html>
<head>
<meta name="asq-elements" content="width=device-width, initial-scale=1, user-scalable=no">
<title>ASQ-OPTION | Demo</title>
<script src="../webcomponentsjs/webcomponents.js"></script>
<link href="asq-option.html" rel="import">
<style shim-shadowdom>
body {
font-family: RobotoDraft, 'Helvetica Neue', Helvetica, Arial;
font-size: 14px;
margin: 0;
padding: 24px;
-webkit-tap-highlight-color: rgba(0,0,0,0);
-webkit-touch-callout: none;
}
section {
padding: 20px 0;
}
section > div {
padding: 14px;
font-size: 16px;
}
asq-option {
margin: 1em;
}
</style>
</head>
<body>
<template is="auto-binding" >
<style>
asq-option {
cursor: pointer;
}
</style>
<section>
<asq-option type="checkbox" name="o1" selected >A checkbox option</asq-option>
<asq-option type="checkbox" name="o2" disabled>A diabled checkbox option</asq-option>
<asq-option type="radio" name="o3" selected>A radio option</asq-option>
<asq-option type="radio" name="o4" disabled>A diabled radio option</asq-option>
</section>
<script>
var all = document.querySelectorAll('asq-option').array();
var x = all[0];
for ( var y of all ) {
y.addEventListener('asq-option-change', function(e) {
console.log('asq-option-change', e.target.getAttribute('name'), e.target.checked);
});
}
window.onmessage = function(e){
if (typeof e.data.role == "string" && e.data.role.length > 0) {
var allAsqElements = document.querySelectorAll('html /deep/ *');
allAsqElements = Array.prototype.slice.call(allAsqElements).filter(function(el) {
return el.isASQElement;
// return isASQEl(el);
});
//set role for every asq-element in this page
allAsqElements.forEach(function(elem, index) {
elem.role = e.data.role;
});
}
};
</script>
</template>
</body>
</html>