Skip to content

Minify_AutoJs doesn't pick up async="async" and defer="defer" #1226

@jamieburchell

Description

@jamieburchell

Troubleshooting an issue with a deferred script being processed by W3TC as a sync script and discovered that the regex here is not matching scripts that have defer="defer" or async="async".

The longer attribute variation is used when $html5_script_support is true in wp_sanitize_script_attributes() (the meaning of which is actually backwards)

Possible fix: change the regex from:

'~\s+(async|defer)[> ]~is'

to

'~\s+(async|defer)[>= ]~is'

i.e. async or defer followed by a space, equals or greater than.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions