-
Notifications
You must be signed in to change notification settings - Fork 27.4k
refactor(ngSanitize): simplified NON_ALPHANUMERIC_REGEXP #3206
Conversation
@@ -143,7 +143,7 @@ var START_TAG_REGEXP = /^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?: | |||
COMMENT_REGEXP = /<!--(.*?)-->/g, | |||
CDATA_REGEXP = /<!\[CDATA\[(.*?)]]>/g, | |||
URI_REGEXP = /^((ftp|https?):\/\/|mailto:|tel:|#)/, | |||
NON_ALPHANUMERIC_REGEXP = /([^\#-~| |!])/g; // Match everything outside of normal chars and " (quote character) | |||
NON_ALPHANUMERIC_REGEXP = /[^ -~]/g; // Match everything outside of normal chars and " (quote character) |
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.
Alternatively could include escaped formatting characters such as newline (\n) and tab (\t). New regex would be /[^\n\t -~]/g
PR Checklist (Minor Refactor)
|
Have you checked that this doesn't break any unit tests? |
Also can you read our commit message guidelines? |
I have signed the CLA and I just updated the commit message (I believe it matches the required format now). I will double check the tests again to ensure they still pass. |
FYI – your PR is breaking many tests from ngSanitize. I don't think this is a valid change. Closing. |
@chirayuk I apologize. My local copy was out of sync and I have been traveling the last couple weeks. I have updated the change request to fix all failed tests on my branch regarding this change. The double quote was an oversight, but it follows the original intent now. Question, do you know why \n or \t are sanitized? |
…mmits Instead of using fix() or chore() when labelling a commit which improves speed or performance use perf(). Perf commits will be listed in the CHANGELOG under "Performance Improvements". For example: perf($animate): cache all getComputedStyle operations to reduce additional reflows
Putting route parameter examples in braces was misleading newcomers. Closes #5243
Fix the broken build and earn a late (french spelling).
Just my first pass at a more readable format of the guide index. Note: the styles apply to all content in the docs, not just the guide index. This is intentional and I feel that the result is positive.
The labels are set by a script and should not be set manually any more.
Instead of parallelization on a single Travis VM, we use two VMs. - output is nicer (we don't have to buffer e2e tests and then show it at the end) - you can easily see faster the result of unit tests (as it's basically a separate build) We should also make sure we only do the necesary stuff (for install we don't need to do `grunt package` for unit tests, we only need to generate the docs for e2e tests.
Refactoring so that it's easier to use both SL/BS just depending on a global switch.
Copy mock data returned from the mock $httpBackend. This prevents modifications to the response from affecting future responses. Previously, this misbehavior was being mitigated by the deep copy in $resource, but that no longer exists.
Also added a note to the Writing AngularJS Documentation: https://github.com/angular/angular.js/wiki/Writing-AngularJS-Documentation/d0c715ef89 Closes #5261
The url paths in the tutorial are not in line with the actual tutorial code Closes #5264
- referring to `=attr` rather than `=prop` is consistent with note under example with =customerInfo - change `prop` to `attr` (basically `prop` refers to property in JS object, `attr` is for HTML tag) - change the function name in description to match the name in code example Closes #5786
Closes #5813
This issue has been a focus of problems for some users and we discussed it on the IRC that it should be at least documented. ~Amended the style to use bootstrap notes, I think overall it looks better and catches the eyes more easily. However there are no anchor links to these, if these are necessary they can be added later. Closes #3436 Closes #5762
Code uses module names with '2' as suffix while the explanation used the module names without the suffix. The diagram is correct but also does not suffix the module names. Closes #5567
Amended to also clarify this note in the mac/linux tab. Closes #5845
This always throws me off - I think it helps to make it clear that the class name is arbitrary, and what matters is the .ng-etc classes. Closes #5848
Correction misspelling: easist -> easiest Closes #5850
Lets encourage people to use semicolons in javascript :> Closes #5834
The ng-change event triggers immediately, which makes a difference for text input fields and text areas, where the JavaScript onchange event would only be called at the end of the change. Closes #5640
Include mention of `ngSanitize` (and add it to the example), as well as removing (and clarifying if needed) references to `ng-html-bind-unsafe`. Closes #5551
Extend the example with ng-value showing how to deal with default checked radio boxes. Closes #5654
The main api docs page is probably the main landing page for many devs looking to learn angular, so linking to the main guide pages would likely help. Closes #5869
Originally, this issue was regarding documenting `restrict: 'CM'` in the directive guide, but it was pointed out that the restrict documentation is covered in the $compile documentation. Because of this, a link was simply added to the $compile documentation. However, the wording suggests that it's actually linking to the directive registration function, in $compileProvider, so the docs will link there instead. There is a link only a paragraph below to the $compile documentation, so this does not hurt. Closes #5516
The $log provider returns an object and not a function, so this example, which appears to be using the $log provider, should call it as it would be called in a real-world application. Closes #5875
… directive As discussed in comments on 42ec95e#commitcomment-5109829, ngInit is not an element directive, so @clkao's example should reflect this. Closes #5879
…xample the function okToGreet wasn't defined, so this example wouldn't work properly. I've decided that instead of adding unrelated code to the example, it should just be noted that the function is expected to be defined in the lexical scope. Closes #5878
Indentation made Markdown parser think that it’s a block of code. Closes #5446
This removes some outdated advice which no longer is true against the latest angular version. The information about unit testing with ngMocks remains, because it's always good to have information like that easily found. This little snippet is not worded perfectly, and is not a very good example unit test, so additional work is needed here. Relates to #5206 Closes #5485
This probably maybe needs a rebase, but the effort should not go waste |
Simplifies the regex used in ngSanitize for non_alphanumeric to be more
readable by removing unnecessary escaping and improper "or" pipes as well
as streamlining character ranges.
Closes #3192