|
243 | 243 | xboo.setAttribute('foo', 'zot'); |
244 | 244 | }); |
245 | 245 |
|
| 246 | +test('document.register detachedCallbacks in prototype', function(done) { |
| 247 | + var ready, inserted, removed; |
| 248 | + var XBooPrototype = Object.create(HTMLElement.prototype); |
| 249 | + XBooPrototype.detachedCallback = function() { |
| 250 | + removed = true; |
| 251 | + } |
| 252 | + var XBoo = document.registerElement('x-boo-ir2', { |
| 253 | + prototype: XBooPrototype |
| 254 | + }); |
| 255 | + var xboo = new XBoo(); |
| 256 | + assert(!removed, 'removed must be false [XBoo]'); |
| 257 | + work.appendChild(xboo); |
| 258 | + CustomElements.takeRecords(); |
| 259 | + work.removeChild(xboo); |
| 260 | + CustomElements.takeRecords(); |
| 261 | + assert(removed, 'removed must be true [XBoo]'); |
| 262 | + // |
| 263 | + ready = inserted = removed = false; |
| 264 | + var XBooBooPrototype = Object.create(XBooPrototype); |
| 265 | + XBooBooPrototype.detachedCallback = function() { |
| 266 | + XBoo.prototype.detachedCallback.call(this); |
| 267 | + }; |
| 268 | + var XBooBoo = document.registerElement('x-booboo-ir2', { |
| 269 | + prototype: XBooBooPrototype |
| 270 | + }); |
| 271 | + var xbooboo = new XBooBoo(); |
| 272 | + assert(!removed, 'removed must be false [XBooBoo]'); |
| 273 | + work.appendChild(xbooboo); |
| 274 | + CustomElements.takeRecords(); |
| 275 | + work.removeChild(xbooboo); |
| 276 | + CustomElements.takeRecords(); |
| 277 | + assert(removed, 'removed must be true [XBooBoo]'); |
| 278 | + done(); |
| 279 | + }); |
| 280 | + |
246 | 281 | test('document.register can use Functions as definitions', function() { |
247 | 282 | // function used as Custom Element defintion |
248 | 283 | function A$A() { |
|
0 commit comments