| OLD | NEW |
| 1 // Copyright 2012 Google Inc. All Rights Reserved. | 1 // Copyright 2012 Google Inc. All Rights Reserved. |
| 2 | 2 |
| 3 /* | 3 /* |
| 4 Distributed under both the W3C Test Suite License [1] and the W3C | 4 Distributed under both the W3C Test Suite License [1] and the W3C |
| 5 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the | 5 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the |
| 6 policies and contribution forms [3]. | 6 policies and contribution forms [3]. |
| 7 | 7 |
| 8 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license | 8 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license |
| 9 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license | 9 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license |
| 10 [3] http://www.w3.org/2004/10/27-testcases | 10 [3] http://www.w3.org/2004/10/27-testcases |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 } | 221 } |
| 222 } | 222 } |
| 223 } | 223 } |
| 224 | 224 |
| 225 | 225 |
| 226 //Example taken from http://www.w3.org/TR/shadow-dom/#event-retargeting-example | 226 //Example taken from http://www.w3.org/TR/shadow-dom/#event-retargeting-example |
| 227 function createTestMediaPlayer(d) { | 227 function createTestMediaPlayer(d) { |
| 228 d.body.innerHTML = '' + | 228 d.body.innerHTML = '' + |
| 229 '<div id="player">' + | 229 '<div id="player">' + |
| 230 '<input type="checkbox" id="outside-control">' + | 230 '<input type="checkbox" id="outside-control">' + |
| 231 » » '<div id="player-shadow-root">' + | 231 » » '<div id="player-shadow-host">' + |
| 232 '</div>' + | 232 '</div>' + |
| 233 '</div>'; | 233 '</div>'; |
| 234 | 234 |
| 235 » var playerShadowRoot = d.querySelector('#player-shadow-root').createShad
owRoot(); | 235 » var playerShadowRoot = d.querySelector('#player-shadow-host').createShad
owRoot(); |
| 236 playerShadowRoot.innerHTML = '' + | 236 playerShadowRoot.innerHTML = '' + |
| 237 '<div id="controls">' + | 237 '<div id="controls">' + |
| 238 '<button class="play-button">PLAY</button>' + | 238 '<button class="play-button">PLAY</button>' + |
| 239 » » » '<input type="range" id="timeline">' + | 239 » » » '<div tabindex="0" id="timeline">' + |
| 240 » » » » '<div id="timeline-shadow-root">' + | 240 » » » » '<div id="timeline-shadow-host">' + |
| 241 '</div>' + | 241 '</div>' + |
| 242 » » » '</input>' + | 242 » » » '</div>' + |
| 243 '<div class="volume-slider-container" id="volume-slider-cont
ainer">' + | 243 '<div class="volume-slider-container" id="volume-slider-cont
ainer">' + |
| 244 » » '<input type="range" class="volume-slider" id="volume-sl
ider">' + | 244 » » '<div tabindex="0" class="volume-slider" id="volume-slid
er">' + |
| 245 » » '<div id="volume-shadow-root">' + | 245 » » '<div id="volume-shadow-host">' + |
| 246 '</div>' + | 246 '</div>' + |
| 247 » » '</input>' + | 247 » » '</div>' + |
| 248 '</div>' + | 248 '</div>' + |
| 249 '</div>'; | 249 '</div>'; |
| 250 | 250 |
| 251 » var timeLineShadowRoot = playerShadowRoot.querySelector('#timeline-shado
w-root').createShadowRoot(); | 251 » var timeLineShadowRoot = playerShadowRoot.querySelector('#timeline-shado
w-host').createShadowRoot(); |
| 252 timeLineShadowRoot.innerHTML = '<div class="slider-thumb" id="timeline-
slider-thumb"></div>'; | 252 timeLineShadowRoot.innerHTML = '<div class="slider-thumb" id="timeline-
slider-thumb"></div>'; |
| 253 | 253 |
| 254 » var volumeShadowRoot = playerShadowRoot.querySelector('#volume-shadow-ro
ot').createShadowRoot(); | 254 » var volumeShadowRoot = playerShadowRoot.querySelector('#volume-shadow-ho
st').createShadowRoot(); |
| 255 volumeShadowRoot.innerHTML = '<div class="slider-thumb" id="volume-slide
r-thumb"></div>'; | 255 volumeShadowRoot.innerHTML = '<div class="slider-thumb" id="volume-slide
r-thumb"></div>'; |
| 256 | 256 |
| 257 return { | 257 return { |
| 258 'playerShadowRoot': playerShadowRoot, | 258 'playerShadowRoot': playerShadowRoot, |
| 259 'timeLineShadowRoot': timeLineShadowRoot, | 259 'timeLineShadowRoot': timeLineShadowRoot, |
| 260 'volumeShadowRoot': volumeShadowRoot | 260 'volumeShadowRoot': volumeShadowRoot |
| 261 }; | 261 }; |
| 262 } | 262 } |
| 263 | 263 |
| 264 //FIXME This call of initKeyboardEvent works for WebKit-only. | 264 //FIXME This call of initKeyboardEvent works for WebKit-only. |
| 265 //See https://bugs.webkit.org/show_bug.cgi?id=16735 | 265 //See https://bugs.webkit.org/show_bug.cgi?id=16735 |
| 266 // and https://bugs.webkit.org/show_bug.cgi?id=13368. Add check for browser here | 266 // and https://bugs.webkit.org/show_bug.cgi?id=13368. Add check for browser here |
| 267 function fireKeyboardEvent(doc, element, key) { | 267 function fireKeyboardEvent(doc, element, key) { |
| 268 var event = doc.createEvent('KeyboardEvent'); | 268 var event = doc.createEvent('KeyboardEvent'); |
| 269 event.initKeyboardEvent("keydown", true, true, doc.defaultView, key, 0, fals
e, false, false, false); | 269 event.initKeyboardEvent("keydown", true, true, doc.defaultView, key, 0, fals
e, false, false, false); |
| 270 element.dispatchEvent(event); | 270 element.dispatchEvent(event); |
| 271 } | 271 } |
| OLD | NEW |