Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#23739 closed feature request (wontfix)

Modernizr

Reported by: yramagicman's profile yramagicman Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.5
Component: External Libraries Keywords: close
Focuses: Cc:

Description

Why doesn't WordPress bundle Modenrizr along with the rest of the scripts? It would make sense considering the number of people who use HTML5 and CSS3 in their themes.

Change History (7)

#1 @SergeyBiryukov
12 years ago

  • Component changed from General to External Libraries
  • Keywords close added
  • Version changed from trunk to 3.5

Why doesn't WordPress bundle Modenrizr along with the rest of the scripts?

It has no use in core at the moment.

#2 @nacin
12 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Indeed, we only bundle scripts that we need and use.

#3 @yramagicman
12 years ago

Ok, that makes sense. I guess I'll just have to keep adding it to my themes the "old fashion" way.

#4 @ocean90
11 years ago

#24568 was marked as a duplicate.

#5 @Looimaster
11 years ago

"It has no use in core at the moment."
"Indeed, we only bundle scripts that we need and use."

Do you use jquery-effects-blind, jquery-effects-bounce, jquery-effects-clip, jquery-effects-drop, jquery-effects-explode, [...10 more...], jquery-ui-selectable, jquery-ui-position, jquery-ui-accordion, prototype, scriptaculous-root etc. in core?

1) Number of people that would like to use jquery-ui-selectable in their themes or plugins: 1 out of 100.
2) Number of people that would like to use Modernizr in their themes or plugins: 10 out of 100.

I think that nowadays every other theme or plugin wants to detect touch devices and hide elements or change position: fixed; to position: absolute; for them. It makes a lot of sense to use Modernizr and not something like wp_is_mobile() (the biggest problem: it's PHP and doesn't allow JS nor CSS detection and such detection is needed right there). I would open a discussion for this library. It becomes more and more useful as more touch devices appear and browser market is differentiating.

#6 @nacin
11 years ago

We made a choice to specifically include all of jQuery UI, because we were already using a number of components, because the components and their dependencies are fluid, and because it was really confusing. Pieces of jQuery UI is different from an entirely different library from a different vendor.

Regarding Prototype and Scriptaculous: We also bundle scripts we used to use. But, we recently unbundled both of these and now point to Google's CDN.

#7 @Looimaster
11 years ago

I see and I'm very happy that full jQuery UI is there. It should stay there.

Well, I think that Modernizr should be used in WordPress core because it is as simple as this:

if ( Modernizr.touch ) {
  // do something like replace <video> with its poster image
}

or

.touch .element { display: none; }

And detecting user agents in wp_is_mobile() isn't reliable and not applicable to CSS. That's just my suggestion. jQuery is used by 95 out of 100 people and Modernizr would be used by perhaps 10/100 people.

Note: See TracTickets for help on using tickets.