File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -240,8 +240,7 @@ Component.prototype = {
240240 */
241241 flushToDOM : function ( isDefault ) {
242242 var attrValue = isDefault ? this . data : this . attrValue ;
243- // don't ignore boolean values
244- if ( ! attrValue && typeof attrValue !== 'boolean' ) { return ; }
243+ if ( attrValue === null || attrValue === undefined ) { return ; }
245244 window . HTMLElement . prototype . setAttribute . call ( this . el , this . attrName ,
246245 this . stringify ( attrValue ) ) ;
247246 } ,
Original file line number Diff line number Diff line change @@ -979,6 +979,16 @@ suite('Component', function () {
979979 sinon . assert . notCalled ( updateStub ) ;
980980 assert . equal ( HTMLElement . prototype . getAttribute . call ( el , 'dummy' ) , 'color: blue' ) ;
981981 } ) ;
982+
983+ test ( 'flushes false boolean' , function ( ) {
984+ var el = document . createElement ( 'a-entity' ) ;
985+ registerComponent ( 'dummy' , {
986+ schema : { isDurrr : { default : true } }
987+ } ) ;
988+ el . setAttribute ( 'dummy' , { isDurrr : false } ) ;
989+ el . components . dummy . flushToDOM ( ) ;
990+ assert . equal ( HTMLElement . prototype . getAttribute . call ( el , 'dummy' ) , 'isDurrr: false' ) ;
991+ } ) ;
982992 } ) ;
983993
984994 suite ( 'play' , function ( ) {
You can’t perform that action at this time.
0 commit comments