0

As a result of my customizing of wp-login.php, using HTML5 (e.g. placeholders etc.) and CSS3 (e.g. various selectors), I would like to polyfill for older browsers.

Does WordPress, by default, have polyfill scripts already baked into the login/admin area or do I need to begin enqueuing polyfill scripts of my own?

Example:

add_action( 'login_enqueue_scripts', 'wpse_215432_oldbrowsersupport');
function wpse_215432_oldbrowsersupport() {
    wp_register_script( 'ie_html5shiv', get_stylesheet_directory_uri().'/js/html5shiv.min.js', __FILE__, false, '3.7.3' );
    wp_enqueue_script( 'ie_html5shiv');
    wp_script_add_data( 'ie_html5shiv', 'conditional', 'lt IE 9' );
}
  • 1
    No clue what are you asking. Mind editing your question to make it obvious? (why does a simple html form need a polyfill at all?) Anyway this sounds like a JS question which might be off-topic. – Mark Kaplun Jan 23 '16 at 8:50
  • 1
    The log-in page works without polyfill. – fuxia Jan 23 '16 at 10:41
  • @toscho ...therefore enqueuing my own polyfills isn't duplicitous. – Clarus Dignus Jan 23 '16 at 10:44
  • It isn't necessary. – fuxia Jan 23 '16 at 11:33
  • @toscho Not being a Smart Alec but as per the first and second clauses of the first sentence of my question, it is ("it" meaning "enqueuing my own polyfills" and "is" meaning "necessary"). – Clarus Dignus Jan 23 '16 at 14:27
0

I asked a more general (non-WordPress specific) question about polyfilling on StackOverflow (I strongly recommend reading through the ensuing comments for context) which has lead me to the following answer:

add_action( 'login_enqueue_scripts', 'wpse_215432_oldbrowsersupport');
function wpse_215432_oldbrowsersupport() {

    wp_register_script( 'ie_html5shiv', get_stylesheet_directory_uri().'/js/html5shiv.min.js', __FILE__, false, '3.7.3' );
    wp_enqueue_script( 'ie_html5shiv');
    wp_script_add_data( 'ie_html5shiv', 'conditional', 'lt IE 9' );

    //Note: Placeholder script (https://github.com/mathiasbynens/jquery-placeholder) covered by a plugin https://wordpress.org/plugins/html5-placeholder-polyfill/

    wp_register_script( 'ie_selectivizr', get_stylesheet_directory_uri().'/js/selectivizr.js', __FILE__, false, '1.0.3' );
    wp_enqueue_script( 'ie_selectivizr');
    wp_script_add_data( 'ie_selectivizr', 'conditional', 'lt IE 9' );

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.