JavaScript
In Drupal 8 we are going to make JavaScript rock! We want JavaScript we can all be proud of. Currently we have an 8-part plan to get there.
Clean Up The Current Code
There is room to improve our current JS:
- #1481560: Add "use strict" to all core JavaScript to enforce clean code
- #1415788: Javascript winter clean-up
- #1574470: Selectors clean-up
- #1419652: JavaScript logging and error reporting
- #1440628: [Meta] javascript toolbar/tableheader with url fragment mess
Unit Testing
JS Unit testing via QUnit, even possibly something like jQuery Swarm.
Better Inline Documentation
Drupal is one of the best documented open source projects. Time to bring our JS up to the level of everything else.
Pluggable Preprocessing
Sometimes we write modules like Bundle Cache or we want to load scripts via scripts like labjs. Making preprocessing/aggregation pluggable means we can do some awesome stuff there.
- #352951: Make JS & CSS Preprocessing Pluggable
- #1014086: Stampedes and cold cache performance issues with css/js aggregation
Drupal JS Handbook Awesomeness
"JavaScript is the only language that I'm aware of that people feel they don't need to learn before they start using it." -- Douglas Crockford
Let's teach people how to do our common stuff.
JSLint/JSHint
JSLint and JSHint are great for helping us keep our JS from doing bad things. Let's use one of them in both our personal dev processes and coder module.
#1664940: [Policy, patch] Decide on JSHint configuration
Minification
Let's minify our JS. The size savings can translate into real end user performance.
Solid Architectural Patterns For All The JS
There is a LOT of JS in Drupal 7 and we imagine even more in Drupal 8. Architecturally we can benefit from using modular patterns, like what Dojo or jQuery UI are using. In addition there are some libraries, like underscore, that may be able to provide utilities that help us write better JS.
- #1542344: Use AMD for JS architecture
- #1541860: Reduce dependency on jQuery
- #1446166: Use JS events instead of Drupal.behaviors
- #1090592: [meta] Use HTML5 data-drupal-* attributes instead of #ID selectors in Drupal.settings
- #1033392: Script loader support in core (LABjs etc.)
- #1172670: Evaluate standardized usage of HTML5 Storage API through a library
See also all core 8.0.x issues that have anything to do with javascript.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion