-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move polyfill from a module import to "native" Ember.String.isHTMLSafe #2
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
92784aa
Update ember-cli to v2.11.1 and 'ember init'
Panman82 d3a6185
Add additional test scenarios
Panman82 b80392d
Move polyfill from a module import to "native" Ember.String.isHTMLSafe
Panman82 f52ed76
Add additional test scenarios to travis-ci and add badge to README
Panman82 7d238e8
Changes from PR review
Panman82 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,6 @@ | |
"strict": false, | ||
"white": false, | ||
"eqnull": true, | ||
"esnext": true, | ||
"esversion": 6, | ||
"unused": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
# ember-string-ishtmlsafe-polyfill | ||
# ember-string-ishtmlsafe-polyfill [![Build Status](https://travis-ci.org/workmanw/ember-string-ishtmlsafe-polyfill.svg?branch=master)](https://travis-ci.org/workmanw/ember-string-ishtmlsafe-polyfill) | ||
|
||
This provides a polyfill for the `Ember.String.isHTMLSafe` feature that has landed in ember/master. It is likely to ship with Ember 2.8 or 2.9. | ||
This provides a polyfill for the `Ember.String.isHTMLSafe` feature added in Ember 2.8. | ||
|
||
RFC: [emberjs/rfcs#139](https://github.com/emberjs/rfcs/pull/139). | ||
|
||
PR: [emberjs/ember.js#13666](https://github.com/emberjs/ember.js/pull/13666). | ||
|
||
API: [Ember.String.htmlSafe](http://emberjs.com/api/classes/Ember.String.html#method_isHTMLSafe) | ||
|
||
|
||
## Installation | ||
|
||
|
@@ -15,24 +17,40 @@ ember install ember-string-ishtmlsafe-polyfill | |
|
||
|
||
## Usage | ||
|
||
```javascript | ||
import isHTMLSafe from 'ember-string-ishtmlsafe-polyfill'; | ||
|
||
export default Ember.Service.extend({ | ||
someMethod(str) { | ||
if (isHTMLSafe(str)) { | ||
str = str.toString(); | ||
} | ||
// Do something with native string | ||
} | ||
}); | ||
import Ember from 'ember'; | ||
|
||
var plainString = 'plain string'; | ||
var safeString = Ember.String.htmlSafe('<div>someValue</div>'); | ||
|
||
Ember.String.isHTMLSafe(plainString); // false | ||
Ember.String.isHTMLSafe(safeString); // true | ||
``` | ||
|
||
|
||
## Migration | ||
|
||
### Applications | ||
|
||
After you upgrade your application to Ember 2.8, you should remove `ember-string-ishtmlsafe-polyfill` | ||
from your `package.json`. | ||
|
||
### Addons | ||
|
||
Addons generally support many different Ember versions, so leaving `ember-string-ishtmlsafe-polyfill` | ||
in place for consumers of your addon is perfectly normal. When the addon no longer supports | ||
Ember versions older than 2.8, we recommend removing `ember-string-ishtmlsafe-polyfill` from | ||
your `package.json` and doing a major version bump. | ||
|
||
|
||
## Compatibility | ||
|
||
This addon is tested against each minor ember version starting with 1.10 through 2.5. Additionally tested against, | ||
`ember-stable`, `ember-beta`, and `ember-canary`. A complete list can be found in the [`ember-try.js](https://github.com/workmanw/ember-string-ishtmlsafe-polyfill/blob/master/config/ember-try.js) config. | ||
This addon is tested against each minor ember version starting with 1.10 through 2.8 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/ember/Ember/ |
||
(when `isHTMLSafe()` landed). Additionally tested against, `ember-stable`, `ember-beta`, | ||
and `ember-canary`. A complete list can be found in the | ||
[`ember-try.js`](https://github.com/workmanw/ember-string-ishtmlsafe-polyfill/blob/master/config/ember-try.js) | ||
config. | ||
|
||
|
||
## Running Tests | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import Ember from 'ember'; | ||
|
||
function isHTMLSafePolyfill(str) { | ||
return str && typeof str.toHTML === 'function'; | ||
} | ||
Ember.deprecate("ember-string-ishtmlsafe-polyfill is now a true polyfill. Use Ember.String.isHTMLSafe directly instead of importing from ember-string-ishtmlsafe-polyfill", false, { | ||
id: "ember-string-ishtmlsafe-polyfill.import", | ||
until: '2.0.0' | ||
}); | ||
|
||
export default Ember.String.isHTMLSafe || isHTMLSafePolyfill; | ||
export default Ember.String.isHTMLSafe; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,4 @@ | ||
{ | ||
"name": "ember-string-ishtmlsafe-polyfill", | ||
"dependencies": { | ||
"ember": "~2.4.3", | ||
"ember-cli-shims": "0.1.1", | ||
"ember-cli-test-loader": "0.2.2", | ||
"ember-qunit-notifications": "0.1.0" | ||
} | ||
"dependencies": {} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ember-cli made a mistake here (and we are revertting the update to the
LICENSE.md
blueprint).@Panman8201 - Can you change this to
2016-2017
instead of just updating to 2017?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually manually made that change, not ember-cli's fault! :) I'll change it to your suggestion.