File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 4747 contribute : {
4848
4949 contentChanged : function ( ) {
50+ this . _listenForLoadEvents ( 'img' ) ;
51+ this . _listenForLoadEvents ( 'iframe' ) ;
5052 setTimeout ( function ( ) {
5153 this . recalc ( ) ;
5254 } . bind ( this ) ) ;
105107 this . $ . stackContainer . style . width = '100%' ;
106108 this . recalc ( ) ;
107109 }
110+ } ,
111+
112+ // Listen for load events on children of the specified tag type.
113+ // TODO: Share this with basic-framed-content.
114+ _listenForLoadEvents : function ( tag ) {
115+ var childNodes = Basic . ContentHelpers . flattenChildNodes ( this ) ;
116+ Array . prototype . forEach . call ( childNodes , function ( child ) {
117+ if ( child . localName === tag ) {
118+ child . addEventListener ( 'load' , function ( ) {
119+ this . recalc ( ) ;
120+ } . bind ( this ) ) ;
121+ }
122+ } . bind ( this ) ) ;
108123 }
109124
110125} ) ;
You can’t perform that action at this time.
0 commit comments