@@ -310,6 +310,44 @@ htmlSuite('Document', function() {
310
310
assert . equal ( b2 . getName ( ) , 'b' ) ;
311
311
} ) ;
312
312
313
+ test ( 'document.register deeper' , function ( ) {
314
+ if ( ! document . register )
315
+ return ;
316
+
317
+ function C ( ) { }
318
+ C . prototype = {
319
+ __proto__ : HTMLElement . prototype
320
+ } ;
321
+
322
+ function B ( ) { }
323
+ B . prototype = {
324
+ __proto__ : C . prototype
325
+ } ;
326
+
327
+ function A ( ) { }
328
+ A . prototype = {
329
+ __proto__ : B . prototype
330
+ } ;
331
+
332
+ A = document . register ( 'x-a5' , A ) ;
333
+
334
+ var a1 = document . createElement ( 'x-a5' ) ;
335
+ assert . equal ( 'x-a5' , a1 . localName ) ;
336
+ assert . equal ( a1 . __proto__ , A . prototype ) ;
337
+ assert . equal ( a1 . __proto__ . __proto__ , B . prototype ) ;
338
+ assert . equal ( a1 . __proto__ . __proto__ . __proto__ , C . prototype ) ;
339
+ assert . equal ( a1 . __proto__ . __proto__ . __proto__ . __proto__ ,
340
+ HTMLElement . prototype ) ;
341
+
342
+ var a2 = new A ( ) ;
343
+ assert . equal ( 'x-a5' , a2 . localName ) ;
344
+ assert . equal ( a2 . __proto__ , A . prototype ) ;
345
+ assert . equal ( a2 . __proto__ . __proto__ , B . prototype ) ;
346
+ assert . equal ( a2 . __proto__ . __proto__ . __proto__ , C . prototype ) ;
347
+ assert . equal ( a2 . __proto__ . __proto__ . __proto__ . __proto__ ,
348
+ HTMLElement . prototype ) ;
349
+ } ) ;
350
+
313
351
test ( 'document.register createdCallback' , function ( ) {
314
352
if ( ! document . register )
315
353
return ;
@@ -328,7 +366,7 @@ htmlSuite('Document', function() {
328
366
}
329
367
}
330
368
331
- A = document . register ( 'x-aa ' , A ) ;
369
+ A = document . register ( 'x-a2 ' , A ) ;
332
370
333
371
var a = new A ;
334
372
assert . equal ( createdCalls , 1 ) ;
@@ -358,7 +396,7 @@ htmlSuite('Document', function() {
358
396
}
359
397
}
360
398
361
- A = document . register ( 'x-aaa ' , A ) ;
399
+ A = document . register ( 'x-a3 ' , A ) ;
362
400
363
401
var a = new A ;
364
402
document . body . appendChild ( a ) ;
@@ -367,8 +405,7 @@ htmlSuite('Document', function() {
367
405
assert . equal ( leftDocumentCalls , 1 ) ;
368
406
} ) ;
369
407
370
- test ( 'document.register attributeChangedCallback' ,
371
- function ( ) {
408
+ test ( 'document.register attributeChangedCallback' , function ( ) {
372
409
if ( ! document . register )
373
410
return ;
374
411
@@ -398,7 +435,7 @@ htmlSuite('Document', function() {
398
435
}
399
436
}
400
437
401
- A = document . register ( 'x-aaaa ' , A ) ;
438
+ A = document . register ( 'x-a4 ' , A ) ;
402
439
403
440
var a = new A ;
404
441
assert . equal ( attributeChangedCalls , 0 ) ;
0 commit comments