Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove viewer page div id #7971

Merged
merged 1 commit into from
Jan 23, 2017

Conversation

davehouse
Copy link
Contributor

This removes the page div id from the viewer. The id, and parsing it for the page number, is replaced by the data-page-number attribute.

The mozilla-cental test that depended on the div.id has been updated to use data-page-number (checked-in for Target Milestone: Firefox 53, Bug 1331795).

This resolves #5897

Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

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

I'm wondering if, for consistency, we should make the same change in pdf_thumbnail_view.js as well?

I.e. do we want to remove line pdf_thumbnail_view.js#L127, and add

div.setAttribute('data-page-number', this.id);

before line pdf_thumbnail_view.js#L129?

@davehouse
Copy link
Contributor Author

@Snuffleupagus thanks! I've added the removal of the .id and addition of the data-page-number attribute for thumbnail divs.

I checked in the mozilla-central tests and did not find any reference to the thumbnails' ids (the two tests of the thumbnails use nth-child selectors: https://dxr.mozilla.org/mozilla-central/source/browser/extensions/pdfjs/test/browser_pdfjs_navigation.js#49,57), and the tests pass locally for me with the id removed.

@timvandermeij
Copy link
Contributor

Looks good. Could you squash the two commits into one commit (refer to https://github.com/mozilla/pdf.js/wiki/Squashing-Commits for how to do this easily)?

@@ -124,8 +124,8 @@ var PDFThumbnailView = (function PDFThumbnailViewClosure() {
this.anchor = anchor;

var div = document.createElement('div');
div.id = 'thumbnailContainer' + id;
Copy link
Contributor

Choose a reason for hiding this comment

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

There is code at

var thumbnail = document.getElementById('thumbnailContainer' + page);
that relies on this being present, so that needs to be updated to use the data-page-number attribute as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you. I added that change and squashed it in 👍

@@ -87,7 +87,7 @@ var PDFThumbnailViewer = (function PDFThumbnailViewerClosure() {
if (selected) {
selected.classList.remove('selected');
}
var thumbnail = document.getElementById('thumbnailContainer' + page);
var thumbnail = document.querySelector('div.thumbnail[data-page-number="' + page + '"]');
Copy link
Contributor

Choose a reason for hiding this comment

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

This line exceeds the maximum length of 80 characters, which causes a linting failure. To resolve this, please change it to:

var thumbnail = document.querySelector(
  'div.thumbnail[data-page-number="' + page + '"]');

The id, and parsing it for the page number, is replaced by the
data-page-number attribute (added here for thumbnails).
@davehouse
Copy link
Contributor Author

Thank you!

@timvandermeij
Copy link
Contributor

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

Command cmd_preview from @timvandermeij received. Current queue size: 0

Live output at: http://107.21.233.14:8877/730171d76776889/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/730171d76776889/output.txt

Total script time: 2.25 mins

Published

@timvandermeij timvandermeij merged commit 2170eda into mozilla:master Jan 23, 2017
@timvandermeij
Copy link
Contributor

Nice work!

movsb pushed a commit to movsb/pdf.js that referenced this pull request Jul 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove page ID and fix tests at mozcentral
4 participants