@@ -56,8 +56,12 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter {
5656 type ( node :string ) {
5757 return node . type ;
5858 }
59- content ( node :HTMLTemplateElement ) :Node {
60- return node . content ;
59+ content ( node :HTMLElement ) :Node {
60+ if ( this . hasProperty ( node , "content" ) ) {
61+ return node . content ;
62+ } else {
63+ return node ;
64+ }
6165 }
6266 firstChild ( el ) :Node {
6367 return el . firstChild ;
@@ -216,10 +220,10 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter {
216220 return element . removeAttribute ( attribute ) ;
217221 }
218222 templateAwareRoot ( el ) {
219- return el instanceof HTMLTemplateElement ? el . content : el ;
223+ return this . isTemplateElement ( el ) ? this . content ( el ) : el ;
220224 }
221225 createHtmlDocument ( ) {
222- return document . implementation . createHTMLDocument ( ) ;
226+ return document . implementation . createHTMLDocument ( 'fakeTitle' ) ;
223227 }
224228 defaultDoc ( ) {
225229 return document ;
@@ -234,7 +238,7 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter {
234238 return n instanceof HTMLElement && n . matches ( selector ) ;
235239 }
236240 isTemplateElement ( el :any ) :boolean {
237- return el instanceof HTMLTemplateElement ;
241+ return el instanceof HTMLElement && el . nodeName == "TEMPLATE" ;
238242 }
239243 isTextNode ( node :Node ) :boolean {
240244 return node . nodeType === Node . TEXT_NODE ;
@@ -255,10 +259,10 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter {
255259 var result = document . importNode ( node , true ) ;
256260 // Workaround WebKit https://bugs.webkit.org/show_bug.cgi?id=137619
257261 if ( this . isTemplateElement ( result ) &&
258- ! result . content . childNodes . length && node . content . childNodes . length ) {
259- var childNodes = node . content . childNodes ;
262+ ! this . content ( result ) . childNodes . length && this . content ( node ) . childNodes . length ) {
263+ var childNodes = this . content ( node ) . childNodes ;
260264 for ( var i = 0 ; i < childNodes . length ; ++ i ) {
261- result . content . appendChild (
265+ this . content ( result ) . appendChild (
262266 this . importIntoDoc ( childNodes [ i ] ) ) ;
263267 }
264268 }
0 commit comments