Changing panel domtree with jquery does not work with safari

I am trying to manipulate the domtree of the panel image viewer using jquery which is included by the panel via a custom field. It loads correctly since it can output console.log but dom manipulations do not show up in safari. BUT they do show up in firefox and chrome.

any ideas why?

bild = $('.fileview-image .fileview-image-link img');
bild.wrap("<div id='bild'></div>");

i found out that safari fires event ‘dom ready’ too early. fixed it using this…

like that (coffescript):

 $ ->
   if $.browser.webkit and document.readyState != 'complete'
     setTimeout( arguments.callee, 1000 )
     console.log 'delayed'
     return

@bastianallgeier
i do not know what causes the dom ready event to fire. but is it possible to change the panel html output that this does not happen to early in safari?
just guessing but does it have to do with http://requirejs.org? or panel.min.js being 230kb? or me working locally using mamp?

solved. i did not create a proper jquery plugin for my custom panel field.