File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 993993 * @return {!string }
994994 */
995995 function serializeSettingsXml ( ) {
996- var serializer ,
996+ var serializer = new xmldom . LSSerializer ( ) ,
997997 /**@type {!string }*/
998- s = "" ;
998+ s = createDocumentElement ( "document-settings" ) ;
999999 // <office:settings/> is optional, but if present must have at least one child element
10001000 if ( self . rootElement . settings && self . rootElement . settings . firstElementChild ) {
1001- serializer = new xmldom . LSSerializer ( ) ;
1002- s = createDocumentElement ( "document-settings" ) ;
10031001 serializer . filter = new odf . OdfNodeFilter ( ) ;
10041002 s += serializer . writeToString ( self . rootElement . settings , odf . Namespaces . namespaceMap ) ;
1005- s += "</office:document-settings>" ;
10061003 }
1007- return s ;
1004+ return s + "</office:document-settings>" ;
10081005 }
10091006 /**
10101007 * @return {!string }
13061303 date = new Date ( ) ,
13071304 settings ;
13081305
1309- settings = serializeSettingsXml ( ) ;
1310- if ( settings ) {
1306+ if ( partMimetypes [ "settings.xml" ] ) {
1307+ settings = serializeSettingsXml ( ) ;
13111308 // Optional according to package spec
13121309 // See http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#__RefHeading__440346_826425813
13131310 data = runtime . byteArrayFromString ( settings , "utf8" ) ;
Original file line number Diff line number Diff line change @@ -195,9 +195,7 @@ odf.OdfContainerTests = function OdfContainerTests(runner) {
195195 t . odf = new odf . OdfContainer ( path , function ( odf ) {
196196 t . odf = odf ;
197197 r . shouldBe ( t , "t.odf.state" , "odf.OdfContainer.DONE" ) ;
198- // The value would only become null if it was a node. By default, random unspecified
199- // attributes on anything are undefined.
200- r . shouldBe ( t , "t.odf.rootElement.settings" , "undefined" ) ;
198+ r . shouldBe ( t , "t.odf.rootElement.settings" , "null" ) ;
201199 checkMimeType ( t , path , callback ) ;
202200 } ) ;
203201 } ) ;
You can’t perform that action at this time.
0 commit comments