@@ -42,7 +42,7 @@ class Result {
4242 }
4343 }
4444
45- return insertIntoIndexHTML ( this . _html , this . _head , this . _body ) ;
45+ return insertIntoIndexHTML ( this . _html , this . _head , this . _body , this . _bodyAttributes ) ;
4646 }
4747
4848 /**
@@ -109,6 +109,12 @@ class Result {
109109 let head = this . _doc . head ;
110110 let body = this . _doc . body ;
111111
112+ if ( body . attributes . length > 0 ) {
113+ this . _bodyAttributes = HTMLSerializer . attributes ( body . attributes ) ;
114+ } else {
115+ this . _bodyAttributes = null ;
116+ }
117+
112118 if ( head ) {
113119 head = HTMLSerializer . serializeChildren ( head ) ;
114120 }
@@ -124,7 +130,7 @@ function missingTag(tag) {
124130 return Promise . reject ( new Error ( `Fastboot was not able to find ${ tag } in base HTML. It could not replace the contents.` ) ) ;
125131}
126132
127- function insertIntoIndexHTML ( html , head , body ) {
133+ function insertIntoIndexHTML ( html , head , body , bodyAttributes ) {
128134 if ( ! html ) { return Promise . resolve ( html ) ; }
129135 let isBodyReplaced = false ;
130136 let isHeadReplaced = false ;
@@ -140,6 +146,12 @@ function insertIntoIndexHTML(html, head, body) {
140146 return '' ;
141147 } ) ;
142148
149+ if ( bodyAttributes ) {
150+ html = html . replace ( / < b o d y [ ^ > ] * / i, function ( match ) {
151+ return match + ' ' + bodyAttributes ;
152+ } ) ;
153+ }
154+
143155 if ( head && ! isHeadReplaced ) {
144156 return missingTag ( '<!--EMBER_CLI_FASTBOOT_HEAD-->' ) ;
145157 }
0 commit comments