File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change 211211 p5 . prototype . createImg = function ( ) {
212212 var elt = document . createElement ( 'img' ) ;
213213 var args = arguments ;
214- var self = { } ;
214+ var self ;
215215 var setAttrs = function ( ) {
216- self . width = elt . width ;
217- self . height = elt . height ;
218- if ( args . length === 3 && typeof args [ 2 ] === 'function' ) {
216+ self . width = elt . offsetWidth ;
217+ self . height = elt . offsetHeight ;
218+ if ( args . length > 1 && typeof args [ 1 ] === 'function' ) {
219+ self . fn = args [ 1 ] ;
220+ self . fn ( ) ;
221+ } else if ( args . length > 1 && typeof args [ 2 ] === 'function' ) {
219222 self . fn = args [ 2 ] ;
220223 self . fn ( ) ;
221224 }
224227 if ( args . length > 1 && typeof args [ 1 ] === 'string' ) {
225228 elt . alt = args [ 1 ] ;
226229 }
227- if ( elt . complete ) {
230+ elt . onload = function ( ) {
228231 setAttrs ( ) ;
229- } else {
230- elt . onload = function ( ) {
231- setAttrs ( ) ;
232- }
233232 }
234233 self = addElement ( elt , this ) ;
235234 return self ;
You can’t perform that action at this time.
0 commit comments