HTML include StartFragment EndFragment [solved]

When I copy-past text from firefox to zotero notes it was embedded in tags StartFragment EndFragment .

It seems to only affect Zotero addons: I dont get these tags in a note created in the standalone, or in by pasting in online editor (

I solved it by setting the dom.event.clipboardevents.enabled to false (not sure if it's a good idea, but it works)

These useless tags did bother me for instance, when I created a note and past a text, I could not add something before the pasted text (I needed to delete the tag in the source code to add something else). And these tag were also adding useless data in the DB.

I just though it could be interesting for the Zotero team to know about this.
  • edited December 10, 2016
    Can you provide a Report ID and exact steps to reproduce, including the URL of the page you're copying from? We've never seen this before.
  • Actually, never mind — I can reproduce this on Windows. I'm not sure if this is a new issue — I just noticed this showed up in one other report from a few days ago, but nothing before that. We'll investigate.
  • Sorry for the delay of reply. Thank you Dan.

    By the way setting the dom.event.clipboardevents.enabled to false create some issue on Firefox with the copy past. I can't for instance copy/past anymore in/from a google doc.
  • I started having this same issue once I upgraded to Windows 10. Now, anytime that I cut and paste HTML into a Zotero note, the underlying HTML block is prefaced with


    and terminated with


    This behavior is undesirable because it interferes with the formatting of my note, wherein the note preview, which is typically the first line of the note, does not show up. I have to fix it each time by opening the note, viewing the HTML, and then removing these lines from the beginning and the end of the note.
    1. Is this issue a Zotero problem or a Windows 10 clipboard problem?
    2. Do you have any suggestions for me?
    ZoteroStandalone App, ver
    OSWindows 10 Home, ver 1073
  • I noticed that the StartFragment and EndFragment tags can lead to Zotero crashing. Currently, these tags seem to be properly stripped off when pasting into Zotero notes. However, I found dozens of old notes in my library that include them. As detailed below, this can lead to problems. (It's not an urgent issue, though.)

    It is my understanding that these tags are part of the Windows HTML clipboard and that Zotero's integrated TinyMCE note editor strips them off through configuration of the paste plugin.

    Steps to reproduce

    1. Create a new standalone note in a fresh Zotero installation without any add-ons.
    2. In the note editor, open "Source code".
    3. Paste <p><!--StartFragment-->abc<!--EndFragment--></p>, then click ok.
    4. Move the text cursor in the note editor to the beginning of the line (before "a").
    5. Click on the note in middle pane.
    6. Press the "Tab" key twice. ("Tab" usually jumps into the note editor.)
    7. Zotero crashes.

    Report ID: 624695628

    Debug Output Logging:

    Error Console:
    [JavaScript Error: "TypeError: e.hasAttribute is not a function"
    {file: "resource://zotero/tinymce/tinymce.min.js" line: 2}]

    I can reproduce the issue that the note cannot be edited when the text cursor is at the beginning of a paragraph that is enclosed by <!--StartFragment--><!--EndFragment-->. Debug Output Logging shows "Note hasn't changed".

    It would be nice if a script for the "Run JavaScript" tool could be provided that safely strips <!--StartFragment--> and <!--EndFragment--> tags from Zotero notes. Note that these tags need not appear in pairs, so two independent replacement rules seem appropriate. (It might be that the tags appeared in pairs originally, but further note editing led to broken pairs in my library.)
  • Related errors seem to occur in current TinyMCE versions. I did some tests on in Google's chrome, with "Developer tools" -> "Console". The text between <!-- and --> seems irrelevant.

    A1. Paste <p><!--a-->abc</p> into the "Source code", click ok.
    A2. Paste text before "a".
    A3. TypeError: e.hasAttribute is not a function

    B1. Paste <p><!--a-->abc</p> into the "Source code", click ok.
    B2. Put text cursor before "a" and press "Bold" button.
    B3. DOMException: Failed to execute 'insertNode'

    It seems that <p>abc<!--a--></p> doesn't lead to issues:

    C1. Paste <p>abc<!--a--></p> into the "Source code", click ok.
    C2. Put text cursor before "a" or after "c" and paste text.
    C3. No issues.

    In Zotero, the issue seems to occur when the note's source code e.g. contains <p>abc</p><p><!--a-->def</p>, the text cursor is placed before "d", and then
    a) pressing the "Tab" key,
    b) pressing a button like "Bold", or
    c) pasting text.
    Pressing a character from [0-9a-zA-Z] results in "Note hasn't changed" as noted above.
  • Tags like <!--a--> should be valid comments according to the HTML specification here. I also checked that this passes the Nu Html Checker:
    <!DOCTYPE html>
    <html lang="">

    So it seems to me that TinyMCE has an issue with handling HTML comments without throwing errors.
Sign In or Register to comment.