File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,8 @@ function render (tree, options) {
82
82
if ( typeof obj [ key ] === 'string' ) {
83
83
if ( quoteAllAttributes || obj [ key ] . match ( ATTRIBUTE_QUOTES_REQUIRED ) ) {
84
84
attr += ' ' + key + '="' + obj [ key ] . replace ( / " / g, '"' ) + '"'
85
+ } else if ( obj [ key ] === '' ) {
86
+ attr += ' ' + key
85
87
} else {
86
88
attr += ' ' + key + '=' + obj [ key ]
87
89
}
Original file line number Diff line number Diff line change @@ -327,6 +327,15 @@ describe('PostHTML Render', function () {
327
327
expect ( render ( fixture , options ) ) . to . eql ( expected )
328
328
} )
329
329
330
+ it ( 'Required Empty' , function ( ) {
331
+ var options = { quoteAllAttributes : false }
332
+
333
+ var fixture = { tag : 'script' , attrs : { async : '' } }
334
+ var expected = '<script async></script>'
335
+
336
+ expect ( render ( fixture , options ) ) . to . eql ( expected )
337
+ } )
338
+
330
339
it ( 'Closing slash' , function ( ) {
331
340
var options = {
332
341
closingSingleTag : 'slash' ,
You can’t perform that action at this time.
0 commit comments