This repository was archived by the owner on Mar 13, 2018. It is now read-only.
File tree 2 files changed +36
-2
lines changed
2 files changed +36
-2
lines changed Original file line number Diff line number Diff line change 298
298
299
299
// http://w3c.github.io/webcomponents/spec/shadow/#distribution-algorithms
300
300
distribution : function ( root ) {
301
- this . resetAll ( root ) ;
301
+ this . resetAllSubtrees ( root ) ;
302
302
this . distributionResolution ( root ) ;
303
303
} ,
304
304
308
308
else
309
309
resetDestinationInsertionPoints ( node ) ;
310
310
311
+ this . resetAllSubtrees ( node ) ;
312
+ } ,
313
+
314
+ resetAllSubtrees : function ( node ) {
311
315
for ( var child = node . firstChild ; child ; child = child . nextSibling ) {
312
316
this . resetAll ( child ) ;
313
317
}
Original file line number Diff line number Diff line change @@ -262,4 +262,34 @@ suite('Shadow DOM reprojection', function() {
262
262
var content3 = sr3 . appendChild ( document . createElement ( 'content' ) ) ;
263
263
assert . equal ( getVisualInnerHtml ( div ) , '<a><b><d></d></b></a>' ) ;
264
264
} ) ;
265
- } ) ;
265
+
266
+ test ( 'Polymer Issue 512' , function ( ) {
267
+ // div
268
+ // - shadow-root
269
+ // -- content
270
+ // - a
271
+ // -- shadow-root
272
+ // --- content
273
+ // -- b
274
+
275
+ var div = document . createElement ( 'div' ) ;
276
+ var sr = div . createShadowRoot ( ) ;
277
+ var content = sr . appendChild ( document . createElement ( 'content' ) ) ;
278
+ var a = div . appendChild ( document . createElement ( 'a' ) ) ;
279
+ var b = a . appendChild ( document . createElement ( 'b' ) ) ;
280
+ b . offsetWidth ;
281
+
282
+ var srA = a . createShadowRoot ( ) ;
283
+ var contentA = srA . appendChild ( document . createElement ( 'content' ) ) ;
284
+ // Ensure we don't improperly reset the insertion point for the shadow host
285
+ // node "a" when we re-render it. The fact that "a" was inserted somewhere
286
+ // else is not a concern when we are only re-rendering its shadow root.
287
+ b . offsetWidth ;
288
+
289
+ assertArrayEqual ( content . getDistributedNodes ( ) , [ a ] ) ;
290
+ assertArrayEqual ( contentA . getDistributedNodes ( ) , [ b ] ) ;
291
+
292
+ assertArrayEqual ( a . getDestinationInsertionPoints ( ) , [ content ] ) ;
293
+ assertArrayEqual ( b . getDestinationInsertionPoints ( ) , [ contentA ] ) ;
294
+ } ) ;
295
+ } ) ;
You can’t perform that action at this time.
0 commit comments