Skip to content
This repository has been archived by the owner on Sep 2, 2020. It is now read-only.

Add 3 items to COPY_ATTRIBUTES which are used by iOS. #112

Merged
merged 2 commits into from Dec 11, 2017

Conversation

montehurd
Copy link
Collaborator

@montehurd montehurd commented Dec 8, 2017

const COPY_ATTRIBUTES = ['class', 'style', 'src', 'srcset', 'width', 'height', 'alt']
// The 3 data-* items are used by iOS.
const COPY_ATTRIBUTES = ['class', 'style', 'src', 'srcset', 'width', 'height', 'alt',
'data-file-width', 'data-file-height', 'data-image-gallery'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a pretty harmless change. It's entirely up to your discretion but you may want to update tests for these new attributes. We currently validate all others and don't have to worry about breaking things so much when a change is made.

Just an aside and not a request for revision: on line 77, these attributes will be copied to data-data-* which is a bit clumsy. On the other hand, they can be handled generically without any other changes which is great.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya I had to account for the data-data prefix when implementing tap handling wikimedia/wikipedia-ios@8d50837 on the placeholders (ie if a user taps the placeholder span it was nice to have that still try to show the native gallery for that placeholder's image). Agreed it's a bit clumsy, but figured we could circle back later if we refactor in future.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@niedzielski Tests added :)

@montehurd
Copy link
Collaborator Author

@dbrant gave thumbs-up on irc. merge time!

@montehurd montehurd merged commit 12a5810 into master Dec 11, 2017
@montehurd montehurd deleted the fix/ios-lazy-load-image-taps branch December 11, 2017 19:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
2 participants