fread-ink / epub-cfi-resolver

A simple parser, resolver and generator for the EPUB-CFI format
GNU Affero General Public License v3.0
19 stars 3 forks source link

Vendor extensions aren't ignored #23

Open johnfactotum opened 1 year ago

johnfactotum commented 1 year ago

To reproduce

console.log(new CFI('epubcfi(/4[body01]/10[para05;vnd.foo=bar]/3:10[foobar;vnd.foo=bar])').get())

Expected result

"Implementations MUST ignore all parameters that they do not understand or cannot parse."

[
  [
    { nodeIndex: 4, nodeID: 'body01' },
    { nodeIndex: 10, nodeID: 'para05' },
    { nodeIndex: 3, offset: 10, textLocationAssertion: 'foobar' }
  ]
]

Actual result

Vendor-specific parameters treated as part of ID/text.

[
  [
    { nodeIndex: 4, nodeID: 'body01' },
    { nodeIndex: 10, nodeID: 'para05;vnd.foo=bar' },
    {
      nodeIndex: 3,
      offset: 10,
      textLocationAssertion: 'foobar;vnd.foo=bar'
    }
  ]
]