[annotator-dev] Annotator wrapper setup function

Paolo Caminiti paolo.caminiti at gmail.com
Thu Apr 24 09:25:42 UTC 2014


When calling the annotator on the whole body is there any reason i would go
trough the wrapper function, which detach all scripts and breaks some
pages, instead of just returning the element itself?

I switched from:

   @wrapper = $(@html.wrapper)
    # We need to remove all scripts within the element before wrapping the
    # contents within a div. Otherwise when scripts are reappended to the
DOM
    # they will re-execute. This is an issue for scripts that call
    # document.write() - such as ads - as they will clear the page.
    @element.find('script').remove()
    @element.wrapInner(@wrapper)
    @wrapper = @element.find('.annotator-wrapper')

    this

to simply:

   @wrapper = @element

    this

It seems to work correctly, given we are using the whole body as element,
am i missing something?
Will this fails on some kind of pages?
If not shouldn't it check if the element is the body and eventually skip
the wrapping to be less invasive to pages it is lunched on?


Thank you for the terrific work. Paolo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/annotator-dev/attachments/20140424/bf55c0e1/attachment-0003.html>


More information about the annotator-dev mailing list