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

Omit undefined attributes from noscript images #4639

Merged
merged 4 commits into from
Apr 4, 2018

Commits on Mar 21, 2018

  1. Set default noscript width and height to null

    To solve issue gatsbyjs#4317, this sets the default values of the noscript image's height and width attributes to null. The current default values of "" fail HTML validation because these attributes (if present) must be non-negative integers. Omitting these non-required attributes entirely when no width/height is provided (by setting them to null) solves the validation issue.
    ooloth authored Mar 21, 2018
    Configuration menu
    Copy the full SHA
    6856b3a View commit details
    Browse the repository at this point in the history
  2. Omit undefined attributes from noscriptImg string output

    This edit checks each prop sent to noscriptImg() to see if it exists before adding the relevant attribute to the `<img>` string.
    
    This prevents attributes with undefined values from being added to the markup as empty strings (e.g. `width=""` and `height=""`), which can cause HTML validation errors in some cases.
    
    The two required `<img>` attributes (`src` and `alt`) are included as empty strings by default. All other attributes are omitted if undefined.
    ooloth authored Mar 21, 2018
    Configuration menu
    Copy the full SHA
    5f3890d View commit details
    Browse the repository at this point in the history
  3. Fixed typo in comment

    ooloth authored Mar 21, 2018
    Configuration menu
    Copy the full SHA
    992a09d View commit details
    Browse the repository at this point in the history
  4. Include opacity and transitionDelay prop values

    I accidentally omitted the prop values for opacity and transitionDelay (I only included the default values). 
    
    This edit adds the prop values (if any) back in.
    ooloth authored Mar 21, 2018
    Configuration menu
    Copy the full SHA
    a3ec326 View commit details
    Browse the repository at this point in the history