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

[Review Only] Brackets polyfill support - #8593

Closed
redmunds wants to merge 1 commit into
masterfrom
randy/brackets-polyfill-support
Closed

redmunds wants to merge 1 commit into
masterfrom
randy/brackets-polyfill-support

Conversation

@redmunds

Copy link
Copy Markdown
Contributor

This is an attempt to implement functionality from pull request #7231, and also work with minified builds, but it's not yet working. Brackets works (based on very minimal usage), but the polyfill is not applied.

To create and run a minified build locally:

  1. Setup Grunt
  2. Run grunt build
  3. Hold down Shift key when starting Brackets
  4. When prompted for index.html, use src/dist/index.html

Testing Polyfill Mechanism
The polyfill added to utils/Compatibility.js in this PR is for IE10, so I added a trimAll() polyfill to that file locally so this could be tested in current desktop Brackets (i.e. CEF3 Chrome):

if (!String.prototype.trimAll) {
    String.prototype.trimAll = function () { return this.replace(/\s+/g, ""); };
}
window.console.log("utils/Compatibility loaded!");

I then created a trimTest extension where contents of main.js is:

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

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

    var CommandManager  = brackets.getModule("command/CommandManager"),
        Menus           = brackets.getModule("command/Menus");


    var testString = " this is a test string ";

    function trimTest() {
        if (testString.trimAll) {
            alert("testString: '" + testString + "';\ntestString.trimAll(): '" + testString.trimAll() + "'");
        } else {
            alert("trimAll is not defined");
        }
    }

    Menus.getMenu("debug-menu").addMenuItem(
        CommandManager.register("Trim Test", "trimTest.trimTest", trimTest)
    );
});

To test:
Use Debug > Trim Test

success: alert() says: testString: ' this is a test string '; testString.trimAll(): 'thisisateststring'

failure: alert() says: "trimAll is not defined"

@redmunds

Copy link
Copy Markdown
Contributor Author

PR #8595 will probably replace this one, but keeping open for now.

@JeffryBooher

Copy link
Copy Markdown
Contributor

LFTM -- Is there a reason to do this? Just to make the move to the browser easier for IE10 users?

@JeffryBooher

Copy link
Copy Markdown
Contributor

@redmunds does this work with minified builds yet? I thought I herd that you got it working but the comment in the pr description says that it isn't working yet

@redmunds

redmunds commented Aug 4, 2014

Copy link
Copy Markdown
Contributor Author

@JeffryBooher

LFTM -- Is there a reason to do this? Just to make the move to the browser easier for IE10 users?

Yes, this is to get this to work for IE10 for the Firefox team working on in-browser version. This could have been fixed only for IE10 in an easier way -- this provides an easy way to also add other polyfills in the future.

does this work with minified builds yet?

No, this PR still doesn't work in minified builds. It will most likely be replaced by #8595, but I wanted to keep this open until I'm sure.

@redmunds

redmunds commented Aug 5, 2014

Copy link
Copy Markdown
Contributor Author

#8595 is merged, so closing this one.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants