Lwc: SVGElement.dataset property is undefined

Created on 7 Apr 2020  路  3Comments  路  Source: salesforce/lwc

Description

This propery is part of SVG 2, supported everywhere except IE11.

Steps to Reproduce

Not reproducible in a playground, but is reproducible in scratch org: https://developer.salesforce.com/docs/component-library/tools/playground/cQQz_x2Gd/1/edit

Expected Results

data-foo="bar" attribute to appear on the line element

Actual Results

attribure doesn't appear, exception is thrown

Browsers Affected

Version

  • "@lwc/engine: "1.1.13-224.4"

Possible Solution

Additional context/Screenshots

Lightning Locker

Most helpful comment

Hey @bmblb, Locker needs to whitelist the dataset property. Will be available on latest release, and we'll be discussing if we should backport the fix to earlier releases. Will update you soon! Thanks!

All 3 comments

Thanks for opening all those bugs, really appreciate the time and effort you put into this.
This is not reproducible in the playground because the playground doesn't use Locker Service. Locker is currently filtering access to SVGElement.prototype.dataset. You can verify this using the Locker Console.

/cc @caridy @seksenov

No worries. I'm trying to utilize 3rd party component inside a LWC application. Component uses a lot of native APIs and I'm running into plenty of issues, mostly related to event system. Good news is so far I am able to overcome those by retargeting listeners from window/document/document.body to this.template and this.template.firstChild.

Hey @bmblb, Locker needs to whitelist the dataset property. Will be available on latest release, and we'll be discussing if we should backport the fix to earlier releases. Will update you soon! Thanks!

Was this page helpful?
0 / 5 - 0 ratings