Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Replace String.trimRight() with regex in order to support IE10+ #7231

Merged
merged 3 commits into from
Aug 5, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/brackets.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
*/
define(function (require, exports, module) {
"use strict";

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only changes to brackets.js are whitespace changes, so these changes should be removed.

// Load dependent non-module scripts
require("widgets/bootstrap-dropdown");
require("widgets/bootstrap-modal");
Expand All @@ -57,7 +57,7 @@ define(function (require, exports, module) {
require("thirdparty/CodeMirror2/addon/mode/overlay");
require("thirdparty/CodeMirror2/addon/search/searchcursor");
require("thirdparty/CodeMirror2/keymap/sublime");

// Load dependent modules
var Global = require("utils/Global"),
AppInit = require("utils/AppInit"),
Expand Down
11 changes: 7 additions & 4 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,12 @@ require.config({
locale: window.localStorage.getItem("locale") || (typeof (brackets) !== "undefined" ? brackets.app.language : navigator.language)
});

define(function (require, exports, module) {
define(function (require) {
"use strict";

// Load the brackets module. This is a self-running module that loads and runs the entire application.
require("brackets");

// Load compatibility shims--these need to load early, be careful moving this
require(["utils/Compatibility"], function () {
// Load the brackets module. This is a self-running module that loads and runs the entire application.
require(["brackets"]);
});
});
42 changes: 42 additions & 0 deletions src/utils/Compatibility.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/


/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define */

/**
* Compatibility shims for running Brackets in various environments, browsers.
*/
define(function () {
"use strict";

// [IE10] String.prototype missing trimRight() and trimLeft()
if (!String.prototype.trimRight) {
String.prototype.trimRight = function () { return this.replace(/\s+$/, ""); };
}
if (!String.prototype.trimLeft) {
String.prototype.trimLeft = function () { return this.replace(/^\s+/, ""); };
}

});