-
Notifications
You must be signed in to change notification settings - Fork 83
Description
(This isn't an issue with the widgets, exactly, but I don't see an issue tracker for the browser extension anywhere.)
The Pinterest browser extension doesn't currently seem to pay any attention to the data-pin-media, data-pin-description, etc. attributes on image elements. This means that whenever someone tries to pin an image from our site, it always pins the thumbnail version of the image from the page itself rather than the full-size version, and uses the title of the page as the pin's description instead of the one we've written.
Looking at the extension's code, I think I've managed to track the problem down to the get() function in logic.js. If the attribute it's looking for (e.g. data-pin-media) doesn't exist as a DOM property on the image element, it tries to read it through the element's dataset object. However, the dataset's properties are named like pinMedia rather than data-pin-media, so get() still can't find them. As far as I can tell, either:
a) get() needs to use the getAttribute() method on the element rather than using the dataset at all (this is how the Pinterest widget script does it), OR
b) get() needs to convert the attribute name to the camel-case version before looking it up in dataset, OR
c) everything that calls get() needs to pass the camel-case version of the name instead of the hyphenated, prefixed version.
(The set() function seems to have the same issue, but it never causes any problems there because set() never gets called with a data-* attribute name.)