[wp-trac] [WordPress Trac] #20915: Support for protocol-less URLs in wp_enqueue_*

WordPress Trac wp-trac at lists.automattic.com
Tue Jun 12 07:39:12 UTC 2012


#20915: Support for protocol-less URLs in wp_enqueue_*
--------------------------+------------------------------
 Reporter:  batmoo        |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |
--------------------------+------------------------------

Comment (by batmoo):

 Some test cases:

 {{{
 add_action( 'wp_enqueue_scripts', function() {
         wp_enqueue_script( 'jquery' );
         wp_enqueue_script( 'js-no-proto', '//example.com/js/js.js' );
         wp_enqueue_script( 'js-proto', 'http://example.com/js/js-proto.js'
 );
         wp_enqueue_script( 'js-absolute', '/js/js-proto.js' );
         wp_enqueue_script( 'js-relative', 'js/js-proto.js' );
         wp_enqueue_script( 'js-invalid-proto', 'xyz://example.com/js/js-
 proto.js' );
 } );
 }}}

 Returns:

 {{{
 <script type='text/javascript' src='http://localhost/wp/wp-
 includes/js/jquery/jquery.js?ver=1.7.2'></script>
 <script type='text/javascript'
 src='//example.com/js/js.js?ver=3.4-RC3'></script>
 <script type='text/javascript' src='http://example.com/js/js-
 proto.js?ver=3.4-RC3'></script>
 <script type='text/javascript' src='http://localhost/wp/js/js-
 proto.js?ver=3.4-RC3'></script>
 <script type='text/javascript' src='http://localhost/wpjs/js-
 proto.js?ver=3.4-RC3'></script>
 <script type='text/javascript'
 src='http://localhost/wpxyz://example.com/js/js-
 proto.js?ver=3.4-RC3'></script>
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20915#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list