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

Replace most remaining Element.setAttribute("style", ...) usage with Element.style = ... instead #11569

Merged
merged 1 commit into from Feb 8, 2020

Commits on Feb 5, 2020

  1. Replace most remaining Element.setAttribute("style", ...) usage wit…

    …h `Element.style = ...` instead
    
    This should hopefully be useful in environments where restrictive CSPs are in effect.
    In most cases the replacement is entirely straighforward, and there's only a couple of special cases:
     - For the `src/display/font_loader.js` and `web/pdf_outline_viewer.js `cases, since the elements aren't appended to the document yet, it shouldn't matter if the style properties are set one-by-one rather than all at once.
     - For the `web/debugger.js` case, there's really no need to set the `padding` inline at all and the definition was simply moved to `web/viewer.css` instead.
    
    *Please note:* There's still *a single* case left, in `web/toolbar.js` for setting the width of the zoom dropdown, which is left intact for now.
    The reasons are that this particular case shouldn't matter for users of the general PDF.js library, and that it'd make a lot more sense to just try and re-factor that very old code anyway (thus fixing the `setAttribute` usage in the process).
    Snuffleupagus committed Feb 5, 2020
    Configuration menu
    Copy the full SHA
    5cbd44b View commit details
    Browse the repository at this point in the history