Make WordPress Core

Opened 8 years ago

Closed 6 years ago

#38255 closed enhancement (invalid)

inclusion of javascript script

Reported by: nmoral's profile nmoral Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.6.1
Component: Script Loader Keywords: reporter-feedback
Focuses: Cc:

Description

When I was working on my themes. I tried to include scripts with Javascript src wp but always include scripts with href.
I find class.wp-scripts.php always add base url to my src.
I think it is not good for two reasons:
1 - it is best to use for local javascript src scripts.
2 - I think it is not good practice to replace data theme because if developer wants src it is not good to add data without informing.

I think both solution can be imagined:
1 - just do not replace the data from themes
2 - allow possibility for developer to choose to add automaticly base_url for javascript.

Change History (3)

#1 @dd32
8 years ago

  • Keywords reporter-feedback close added

Hi @nmoral and welcome to Trac.

I'll be honest - I'm not 100% sure on what you're asking for here.

When I was working on my themes. I tried to include scripts with Javascript src wp but always include scripts with href.
I find class.wp-scripts.php always add base url to my src.

This has to be the expected behaviour, since all assets need to be referenced by absolute URL's, can you explain it with a example perhaps?

1 - just do not replace the data from themes

It simply builds a <script> tag based on the data a theme provides, once again, and example of what you get, and what you expect would greatly help

2 - allow possibility for developer to choose to add automaticly base_url for javascript.

The base_url for Javascript is always going to be the sites home_url, there's no really any way around that..

#2 @desrosj
6 years ago

  • Keywords close removed
  • Milestone Awaiting Review deleted

Closing out since no reporter-feedback was provided. Can be reopened with more details if this is still valid.

#3 @SergeyBiryukov
6 years ago

  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.