File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 44 "description" : " XML parser that 100% retains all formatting for creating identical XML on roundtrips" ,
55 "scripts" : {
66 "test" : " bun test --coverage" ,
7- "format" : " prettier --write ."
7+ "format" : " prettier --write ." ,
8+ "typecheck" : " tsc --noEmit"
89 },
910 "keywords" : [
1011 " XML" ,
Original file line number Diff line number Diff line change @@ -145,7 +145,7 @@ export class XmlParser {
145145 }
146146 const wsBeforeEqual = this . readWhitespace ( ) ;
147147 let wsAfterEqual = '' ;
148- let quote = '' ;
148+ let quote = '" ' ;
149149 let value = '' ;
150150 if ( this . peek ( ) === '=' ) {
151151 this . pos ++ ; // skip "="
@@ -163,8 +163,9 @@ export class XmlParser {
163163 value = this . input . substring ( startVal , endVal ) ;
164164 this . pos = endVal + 1 ; // skip closing quote
165165 } else {
166- // Unquoted attribute value.
167- value = this . readUntil ( / [ \s > ] / ) ;
166+ throw new Error (
167+ `Expected quote character at position ${ this . pos } for attribute "${ attrName } "` ,
168+ ) ;
168169 }
169170 }
170171 attributes . push (
@@ -174,7 +175,7 @@ export class XmlParser {
174175 leadingWs ,
175176 wsBeforeEqual ,
176177 wsAfterEqual ,
177- quote ,
178+ quote === '"' || quote === "'" ? quote : '"' ,
178179 ) ,
179180 ) ;
180181 }
You can’t perform that action at this time.
0 commit comments