Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Omit undefined attributes from noscript images (#4639)
* Set default noscript width and height to null To solve issue #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. * 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. * Fixed typo in comment * 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.
- Loading branch information