diff --git a/core/misc/drupal.init.js b/core/misc/drupal.init.js
new file mode 100644
index 0000000..db3b221
--- /dev/null
+++ b/core/misc/drupal.init.js
@@ -0,0 +1,45 @@
+var Drupal = { 'behaviors': {}, 'locale': {} };
+
+// Allow other JavaScript libraries to use $.
+jQuery.noConflict();
+
+// JavaScript should be made compatible with libraries other than jQuery by
+// wrapping it in an anonymous closure.
+(function ($, Drupal, drupalSettings) {
+
+"use strict";
+
+// Populate Drupal.settings with the drupalSettings variable.
+Drupal.settings = drupalSettings;
+
+/**
+ * Freeze the current body height (as minimum height). Used to prevent
+ * unnecessary upwards scrolling when doing DOM manipulations.
+ */
+Drupal.freezeHeight = function () {
+  Drupal.unfreezeHeight();
+  $('<div id="freeze-height"></div>').css({
+    position: 'absolute',
+    top: '0px',
+    left: '0px',
+    width: '1px',
+    height: $('body').css('height')
+  }).appendTo('body');
+};
+
+/**
+ * Unfreeze the body height.
+ */
+Drupal.unfreezeHeight = function () {
+  $('#freeze-height').remove();
+};
+
+// Class indicating that JS is enabled; used for styling purpose.
+document.documentElement.className += ' js';
+
+//Attach all behaviors.
+$(function () {
+  Drupal.attachBehaviors(document, drupalSettings);
+});
+
+})(jQuery, Drupal, window.drupalSettings);
diff --git a/core/misc/drupal.js b/core/misc/drupal.js
index b646e20..8563254 100644
--- a/core/misc/drupal.js
+++ b/core/misc/drupal.js
@@ -1,17 +1,9 @@
-var Drupal = Drupal || { 'behaviors': {}, 'locale': {} };
-
-// Allow other JavaScript libraries to use $.
-jQuery.noConflict();
-
 // JavaScript should be made compatible with libraries other than jQuery by
 // wrapping it in an anonymous closure.
-(function ($, Drupal, drupalSettings) {
+(function (Drupal, drupalSettings) {
 
 "use strict";
 
-// Populate Drupal.settings with the drupalSettings variable.
-Drupal.settings = drupalSettings;
-
 /**
  * Custom error type thrown after attach/detach if one or more behaviors failed.
  *
@@ -401,28 +393,6 @@ Drupal.theme = function (func) {
 };
 
 /**
- * Freeze the current body height (as minimum height). Used to prevent
- * unnecessary upwards scrolling when doing DOM manipulations.
- */
-Drupal.freezeHeight = function () {
-  Drupal.unfreezeHeight();
-  $('<div id="freeze-height"></div>').css({
-    position: 'absolute',
-    top: '0px',
-    left: '0px',
-    width: '1px',
-    height: $('body').css('height')
-  }).appendTo('body');
-};
-
-/**
- * Unfreeze the body height.
- */
-Drupal.unfreezeHeight = function () {
-  $('#freeze-height').remove();
-};
-
-/**
  * Encodes a Drupal path for use in a URL.
  *
  * For aesthetic reasons slashes are not escaped.
@@ -492,30 +462,16 @@ Drupal.ajaxError = function (xmlhttp, uri) {
   return message;
 };
 
-// Class indicating that JS is enabled; used for styling purpose.
-$('html').addClass('js');
-
-//Attach all behaviors.
-$(function () {
-  Drupal.attachBehaviors(document, drupalSettings);
-});
-
 /**
- * The default themes.
+ * Formats text for emphasized display in a placeholder inside a sentence.
+ *
+ * @param str
+ *   The text to format (plain-text).
+ * @return
+ *   The formatted text (html).
  */
-$.extend(Drupal.theme, {
-
-  /**
-   * Formats text for emphasized display in a placeholder inside a sentence.
-   *
-   * @param str
-   *   The text to format (plain-text).
-   * @return
-   *   The formatted text (html).
-   */
-  placeholder: function (str) {
-    return '<em class="placeholder">' + Drupal.checkPlain(str) + '</em>';
-  }
-});
+Drupal.theme.placeholder = function (str) {
+  return '<em class="placeholder">' + Drupal.checkPlain(str) + '</em>';
+};
 
-})(jQuery, Drupal, window.drupalSettings);
+})(Drupal, window.drupalSettings);
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 3b1205a..eb8751e 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -1221,6 +1221,19 @@ function system_library_info() {
     ),
     'dependencies' => array(
       array('system', 'jquery'),
+      array('system', 'drupal.init'),
+    ),
+  );
+
+  // Initalization code executing attachBehaviors.
+  $libraries['drupal.init'] = array(
+    'title' => 'Drupal',
+    'version' => VERSION,
+    'js' => array(
+      'core/misc/drupal.init.js' => array('group' => JS_LIBRARY, 'weight' => -18),
+    ),
+    'dependencies' => array(
+      array('system', 'jquery'),
     ),
   );
 
