[annotator-dev] Annotator wrapper setup function

Randall Leeds tilgovi at hypothes.is
Thu Apr 24 19:51:28 UTC 2014


On Thu, Apr 24, 2014 at 2:25 AM, Paolo Caminiti <paolo.caminiti at gmail.com>wrote:

> 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?
>
>

I can't say why it was this way originally because I wasn't around for
that, but I've been doing the same for a while now and it looks like 2.0
will ship without the wrapper element.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/annotator-dev/attachments/20140424/4060d53d/attachment-0004.html>


More information about the annotator-dev mailing list