Compare commits

...

29 Commits

Author SHA1 Message Date
Pete Bacon Darwin 84951af9e0 chore(package.json): update dist-tag for 1.7.x 2020-06-01 13:04:39 +01:00
George Kalpakas 1e4e382c8b chore(docs.angularjs.org): upgrade Firebase libraries 2020-04-14 16:13:06 +03:00
George Kalpakas 06e50200ba chore(code.angularjs.org): upgrade Firebase libraries 2020-04-14 16:13:05 +03:00
Nishant Mittal 38f21bd422 docs(misc/Version Support Status): Minor Typo Fix
Closes #17012
2020-04-13 15:51:46 +03:00
Sam Katakouzinos 5b037321c3 docs(developers): commit message format typo
Any line of the commit message cannot be longer *than* 100 characters!

Closes #17006
2020-03-11 13:32:56 +02:00
Chives b7753b7a01 docs($aria): get the docs working for the service
Closes #16945
2020-02-07 16:24:47 +02:00
comet 509029b382 docs(*): fix spelling errors
Closes #16942
2020-02-02 11:39:01 +02:00
George Kalpakas 1d97cf9521 chore(*): fix serving of URI-encoded files on code.angularjs.org
The files served for the various versions on https://code.angularjs.org/
are retrieved by a Firebase function from a Firebase Storage bucket
(where they are deployed to from Travis CI). The files are stored
exactly as they are named on disk.

It turns out that some of the files have names with special characters
that get URI-encoded when sent to the Firebase function. For example,
`input[text].html` becomes `input%5Btext%5D.html`. As a result, the
actual file cannot be retrieved from the Storage bucket (since the name
does not match) and `index.html` is returned instead. Apparently, this
never worked, but nobody noticed or reported it until recently.

An example of a failing URL is:
https://code.angularjs.org/1.7.9/docs/api/ng/input/input%5Btext%5D

(NOTE: https://docs.angularjs.org/ works correctly, since the files are
deployed to Firebase hosting directly and not to a Storage bucket.)

This commit fixes the problem by decoding the request path before trying
to retrieve the corresponding file from the Storage bucket.

Closes #16943
2020-02-02 11:24:30 +02:00
George Kalpakas 479699fdcb chore(package): fix scripts for latest Node 10.x on Windows 2020-02-02 11:24:30 +02:00
thatshubham 95b47eb86b docs(angular.errorHandlingConfig): fix typo (wether --> whether)
Closes #16935
2020-01-14 12:26:05 +02:00
thatshubham 124241c739 docs(angular.copy): fix getter/setter formatting
Fix the formatting of `getter`/`setter` in the known limitations section
of the `angular.copy()` docs.

Closes #16934
2020-01-14 12:26:05 +02:00
Angel_Kitty 4021069223 chore(*): update copyright year to 2020
Closes #16930
2020-01-14 12:26:04 +02:00
Pete Bacon Darwin c428d4285d docs: add mention to changelog
(cherry picked from commit 36f17c9262)
2019-11-26 15:25:13 +01:00
Pete Bacon Darwin 16e18a5226 docs: add mention to changelog
(cherry picked from commit ff5f782b20)
2019-11-26 15:25:06 +01:00
Pete Bacon Darwin d257c4564d docs: release notes for 1.7.9 2019-11-19 08:24:10 +00:00
George Kalpakas 1b1684c2b2 docs($compile): fix typos and incorrect example
(cherry picked from commit 1147f0e213)
2019-11-15 16:25:30 +01:00
Pete Bacon Darwin 726f49dcf6 fix(angular.merge): do not merge __proto__ property
By blocking `__proto__` on deep merging, this commit
prevents the `Object` prototype from being polluted.
2019-11-07 15:39:57 +00:00
George Kalpakas 8a187f16c3 chore(saucelabs): switch to latest version of desktop Safari
The currently latest-1 version of desktop Safari (v12.0) on SauceLabs is
completely unstable. Switching to the latest version (currently v12.1),
which works fine.

Closes #16888
2019-07-24 15:55:47 +03:00
George Kalpakas d97e6f1695 chore(saucelabs): upgrade SauceConnect to 4.5.4 2019-07-24 15:55:47 +03:00
byronigoe 26e893a2fa docs(guide/migration): fix typo (misceallenous --> miscellaneous)
Closes #16876
2019-05-28 21:16:33 +03:00
George Kalpakas 5edd25364f fix(ngStyle): correctly remove old style when new style value is invalid
Since d6098eeb1, old styles were not removed if `newStyles` specified an
invalid value for the style (e.g. `false`). The assumption was that the
new style would overwrite the old style value, but using an invalid
value made browsers ignore the new value and thus keep the old style.
This would typically happen when guarding a style with a boolean flag;
e.g.: `ng-style="{backgroundColor: isError && 'red'}"`

This commit essentially revers commit d6098eeb1, whose main purpose was
to work around jquery/jquery#4185. The jQuery issue has been fixed in
3.4.0, so that should not be a problem any more.

Fixes #16860

Closes #16868
2019-05-09 21:27:51 +03:00
Michał Gołębiowski-Owczarek 019dded64b chore(*): update jQuery from 3.2.1 to 3.4.0
This updates jQuery to 3.4.0 to ensure future security fixes won't break it.

Closes #16863
2019-04-12 11:29:42 +02:00
Michał Gołębiowski-Owczarek 0007be1ca2 chore(*): make yarn.lock & GitHub templates identical between master & v1.7.x
Closes #16862
2019-04-12 11:27:05 +02:00
askhalil 863528f299 docs(DEVELOPERS): remove git revert misleading information
Closes #16857
2019-03-26 13:40:37 +02:00
JandersonConstantino 97aff90a2c chore(*): update copyright year 2019-03-22 07:28:48 +00:00
Pete Bacon Darwin dd26545870 docs(CHANGELOG): add 1.7.8 release notes 2019-03-11 11:30:02 +00:00
Martin Staffa a4c7bdccd7 fix(required): correctly validate required on non-input element surrounded by ngIf
Closes #16830
Closes #16836
2019-03-06 18:09:35 +01:00
Ashish Kamble edb3e22c01 docs(guide/di): clarify example description
Closes #16833
2019-03-05 22:01:01 +02:00
Pete Bacon Darwin 7446836e56 chore(scripts): use https for git repo URLs 2019-02-04 13:31:07 +00:00
35 changed files with 3282 additions and 5898 deletions
+8 -3
View File
@@ -1,3 +1,7 @@
# AngularJS is in LTS mode
We are no longer accepting changes that are not critical bug fixes into this project.
See https://blog.angular.io/stable-angularjs-and-long-term-support-7e077635ee9c for more detail.
<!--
IF YOU DON'T FILL OUT THE FOLLOWING INFORMATION WE MIGHT CLOSE YOUR ISSUE WITHOUT INVESTIGATION
-->
@@ -9,8 +13,9 @@ IF YOU DON'T FILL OUT THE FOLLOWING INFORMATION WE MIGHT CLOSE YOUR ISSUE WITHOU
**I'm submitting a ...**
<!-- (check one with "x") -->
- [ ] bug report
- [ ] feature request
- [ ] regression from 1.7.0
- [ ] security issue
- [ ] issue caused by a new browser version
- [ ] other <!--(Please do not submit support requests here - see above)-->
**Current behavior:**
@@ -26,7 +31,7 @@ please provide the *STEPS TO REPRODUCE* and if possible a *MINIMAL DEMO* of the
https://plnkr.co or similar (you can use this template as a starting point: http://plnkr.co/edit/tpl:yBpEi4).
-->
**AngularJS version:** 1.x.y
**AngularJS version:** 1.7.x
<!-- Check whether this is still an issue in the most recent stable or in the snapshot AngularJS
version (https://code.angularjs.org/snapshot/) -->
+7 -2
View File
@@ -1,6 +1,11 @@
<!-- General PR submission guidelines https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#submit-pr -->
**What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)**
# AngularJS is in LTS mode
We are no longer accepting changes that are not critical bug fixes into this project.
See https://blog.angular.io/stable-angularjs-and-long-term-support-7e077635ee9c for more detail.
<!-- General PR submission guidelines https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#submit-pr -->
**Does this PR fix a regression since 1.7.0, a security flaw, or a problem caused by a new browser version?**
<!-- If the answer is no, then we will not merge this PR -->
**What is the current behavior? (You can also link to an open issue here)**
+1
View File
@@ -12,6 +12,7 @@ performance/temp*.html
angular.js.tmproj
node_modules/
angular.xcodeproj
.firebase/
.idea
*.iml
.agignore
+24
View File
@@ -1,3 +1,27 @@
<a name="1.7.9"></a>
# 1.7.9 pollution-eradication (2019-11-19)
## Bug Fixes
- **angular.merge:** do not merge __proto__ property
([726f49](https://github.com/angular/angular.js/commit/726f49dcf6c23106ddaf5cfd5e2e592841db743a))
<br>(Thanks to the [Snyk Security Research Team](https://snyk.io/blog/snyk-research-team-discovers-severe-prototype-pollution-security-vulnerabilities-affecting-all-versions-of-lodash/) for identifyng this issue.)
- **ngStyle:** correctly remove old style when new style value is invalid
([5edd25](https://github.com/angular/angular.js/commit/5edd25364f617083363dc2bd61f9230b38267578),
[#16860](https://github.com/angular/angular.js/issues/16860),
[#16868](https://github.com/angular/angular.js/issues/16868))
<a name="1.7.8"></a>
# 1.7.8 enthusiastic-oblation (2019-03-11)
## Bug Fixes
- **required:** correctly validate required on non-input element surrounded by ngIf
([a4c7bd](https://github.com/angular/angular.js/commit/a4c7bdccd76c39c30e33f6215da9a00cc8acde2c),
[#16830](https://github.com/angular/angular.js/issues/16830),
[#16836](https://github.com/angular/angular.js/issues/16836))
<a name="1.7.7"></a>
# 1.7.7 kingly-exiting (2019-02-04)
+1 -1
View File
@@ -172,7 +172,7 @@ restarted.
git push origin my-fix-branch -f
```
This is generally easier to follow, but seperate commits are useful if the Pull Request contains
This is generally easier to follow, but separate commits are useful if the Pull Request contains
iterations that might be interesting to see side-by-side.
That's it! Thank you for your contribution!
+1 -2
View File
@@ -249,7 +249,7 @@ format that includes a **type**, a **scope** and a **subject**:
The **header** is mandatory and the **scope** of the header is optional.
Any line of the commit message cannot be longer 100 characters! This allows the message to be easier
Any line of the commit message cannot be longer than 100 characters! This allows the message to be easier
to read on GitHub as well as in various git tools.
### Revert
@@ -257,7 +257,6 @@ If the commit reverts a previous commit, it should begin with `revert: `, follow
of the reverted commit.
In the body it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit
being reverted.
A commit with this format is automatically created by the [`git revert`][git-revert] command.
### Type
Must be one of the following:
+1 -1
View File
@@ -1,6 +1,6 @@
The MIT License
Copyright (c) 2010-2018 Google, Inc. http://angularjs.org
Copyright (c) 2010-2020 Google, Inc. http://angularjs.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -222,7 +222,7 @@
<p class="pull-right"><a back-to-top>Back to top</a></p>
<p>
Super-powered by Google ©2010-2018
Super-powered by Google ©2010-2020
(<a id="version"
ng-href="https://github.com/angular/angular.js/blob/master/CHANGELOG.md#{{versionNumber}}"
ng-bind-template="v{{version}}" title="Changelog of this version of AngularJS">
+8 -3
View File
@@ -279,15 +279,20 @@ construction and lookup of dependencies.
Here is an example of using the injector service:
First create an AngularJS module that will hold the service definition. (The empty array passed as
the second parameter means that this module does not depend on any other modules.)
```js
// Provide the wiring information in a module
// Create a module to hold the service definition
var myModule = angular.module('myModule', []);
```
Teach the injector how to build a `greeter` service. Notice that `greeter` is dependent on the
`$window` service. The `greeter` service is an object that contains a `greet` method.
Teach the injector how to build a `greeter` service, which is just an object that contains a `greet`
method. Notice that `greeter` is dependent on the `$window` service, which will be provided
(injected into `greeter`) by the injector.
```js
// Define the `greeter` service
myModule.factory('greeter', function($window) {
return {
greet: function(text) {
+1 -1
View File
@@ -577,7 +577,7 @@ orderByFilter(['a', undefined, 'o', null, 'z']);
<a name="migrate1.6to1.7-ng-misc"></a>
### Core: _Misceallenous_
### Core: _Miscellaneous_
#### **jqLite**
@@ -32,7 +32,7 @@ Any version branch not shown in the following table (e.g. 1.6.x) is no longer be
### Long Term Support
On July 1st 2018, AngularJS entered a Long Term Support period for AngularJS.
On July 1st 2018, AngularJS entered a Long Term Support period.
We now focus exclusively on providing fixes to bugs that satisfy at least one of the following criteria:
+1 -1
View File
@@ -11,7 +11,7 @@ set -e
# Curl and run this script as part of your .travis.yml before_script section:
# before_script:
# - curl https://gist.github.com/santiycr/5139565/raw/sauce_connect_setup.sh | bash
SC_VERSION="4.5.2"
SC_VERSION="4.5.4"
CONNECT_URL="https://saucelabs.com/downloads/sc-$SC_VERSION-linux.tar.gz"
CONNECT_DIR="/tmp/sauce-connect-$RANDOM"
CONNECT_DOWNLOAD="sc-$SC_VERSION-linux.tar.gz"
+4 -4
View File
@@ -3,7 +3,7 @@
"license": "MIT",
"branchVersion": "^1.7.0",
"branchPattern": "1.7.*",
"distTag": "latest",
"distTag": "previous_1_7",
"repository": {
"type": "git",
"url": "https://github.com/angular/angular.js.git"
@@ -59,7 +59,7 @@
"jasmine-core": "^2.8.0",
"jasmine-node": "^2.0.0",
"jasmine-reporters": "^2.2.0",
"jquery": "3.2.1",
"jquery": "3.4.0",
"jquery-2.1": "npm:jquery@2.1.4",
"jquery-2.2": "npm:jquery@2.2.4",
"karma": "^3.1.4",
@@ -101,8 +101,8 @@
"dependencies": {},
"resolutions": {
"//1": "`natives@1.1.0` does not work with Node.js 10.x on Windows 10",
"//2": "(E.g. see https://github.com/gulpjs/gulp/issues/2162.)",
"natives": "1.1.3"
"//2": "(E.g. see https://github.com/gulpjs/gulp/issues/2162 and https://github.com/nodejs/node/issues/25132.)",
"natives": "1.1.6"
},
"commitplease": {
"style": "angular",
+1 -1
View File
@@ -27,7 +27,7 @@ function prepare {
for repo in "${REPOS[@]}"
do
echo "-- Cloning bower-$repo"
git clone git@github.com:angular/bower-$repo.git $TMP_DIR/bower-$repo --depth=1
git clone https://github.com/angular/bower-$repo.git $TMP_DIR/bower-$repo --depth=1
done
@@ -10,7 +10,11 @@ const BROWSER_CACHE_DURATION = 60 * 10;
const CDN_CACHE_DURATION = 60 * 60 * 12;
function sendStoredFile(request, response) {
const requestPath = request.path || '/';
// Request paths will be URI-encoded, so we need to decode them to match the file names in the
// storage bucket. Failing to do so will result in a 404 error from the bucket and `index.html`
// will be returned instead.
// Example of path requiring decoding: `.../input%5Btext%5D.html` --> `.../input[text].html`
const requestPath = decodeURI(request.path || '/');
let filePathSegments = requestPath.split('/').filter((segment) => {
// Remove empty leading or trailing path parts
return segment !== '';
File diff suppressed because it is too large Load Diff
@@ -1,10 +1,13 @@
{
"name": "functions-firebase-code.angularjs.org",
"description": "Cloud Functions to serve files from gcs to code.angularjs.org",
"engines": {
"node": "8"
},
"dependencies": {
"@google-cloud/storage": "^1.1.1",
"firebase-admin": "^5.11.0",
"firebase-functions": "^1.0.4"
"@google-cloud/storage": "^4.7.0",
"firebase-admin": "^8.10.0",
"firebase-functions": "^3.6.0"
},
"private": true
}
+1 -1
View File
@@ -25,7 +25,7 @@ function init {
function prepare {
echo "-- Cloning code.angularjs.org"
git clone git@github.com:angular/code.angularjs.org.git $REPO_DIR --depth=1
git clone https://github.com/angular/code.angularjs.org $REPO_DIR --depth=1
echo "-- Updating code.angularjs.org"
File diff suppressed because it is too large Load Diff
@@ -10,8 +10,8 @@
"logs": "firebase functions:log"
},
"dependencies": {
"firebase-admin": "~5.8.1",
"firebase-functions": "^0.8.1"
"firebase-admin": "^8.10.0",
"firebase-functions": "^3.6.0"
},
"devDependencies": {
"eslint": "^4.12.0",
+4 -3
View File
@@ -11,11 +11,12 @@ export SAUCE_ACCESS_KEY
BROWSER_STACK_ACCESS_KEY=$(echo "$BROWSER_STACK_ACCESS_KEY" | rev)
SAUCE_ACCESS_KEY=$(echo "$SAUCE_ACCESS_KEY" | rev)
# The currently latest version of Safari on Saucelabs (v12) is unstable and disconnects frequently.
# TODO: Add `SL_Safari` back, once/if it becomes more stable again.
# The currently latest-1 version of desktop Safari on Saucelabs (v12.0) is unstable and disconnects
# consistently. The latest version (v12.1) works fine.
# TODO: Add `SL_Safari-1` back, once it no longer corresponds to v12.0.
BROWSERS="SL_Chrome,SL_Chrome-1,\
SL_Firefox,SL_Firefox-1,\
SL_Safari-1,\
SL_Safari,\
SL_iOS,SL_iOS-1,\
SL_IE_9,SL_IE_10,SL_IE_11,\
SL_EDGE,SL_EDGE-1"
+6 -4
View File
@@ -342,8 +342,10 @@ function baseExtend(dst, objs, deep) {
} else if (isElement(src)) {
dst[key] = src.clone();
} else {
if (!isObject(dst[key])) dst[key] = isArray(src) ? [] : {};
baseExtend(dst[key], [src], true);
if (key !== '__proto__') {
if (!isObject(dst[key])) dst[key] = isArray(src) ? [] : {};
baseExtend(dst[key], [src], true);
}
}
} else {
dst[key] = src;
@@ -818,8 +820,8 @@ function arrayRemove(array, value) {
* - [`MediaStream`](https://developer.mozilla.org/docs/Web/API/MediaStream)
* - [`Set`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)
* - [`WeakMap`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/WeakMap)
* - ['getter'](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get)/
* [`setter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set)`
* - [`getter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get)/
* [`setter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set)
*
* @param {*} source The source that will be used to make a copy. Can be any type, including
* primitives, `null`, and `undefined`.
+1 -1
View File
@@ -1,6 +1,6 @@
/**
* @license AngularJS v"NG_VERSION_FULL"
* (c) 2010-2018 Google, Inc. http://angularjs.org
* (c) 2010-2020 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window) {
+1 -1
View File
@@ -1,6 +1,6 @@
/**
* @license AngularJS v"NG_VERSION_FULL"
* (c) 2010-2018 Google, Inc. http://angularjs.org
* (c) 2010-2020 Google, Inc. http://angularjs.org
* License: MIT
*/
'use strict';
+2 -2
View File
@@ -32,7 +32,7 @@ var minErrConfig = {
* non-positive or non-numeric value, removes the max depth limit.
* Default: 5
*
* * `urlErrorParamsEnabled` **{Boolean}** - Specifies wether the generated error url will
* * `urlErrorParamsEnabled` **{Boolean}** - Specifies whether the generated error url will
* contain the parameters of the thrown error. Disabling the parameters can be useful if the
* generated error url is very long.
*
@@ -82,7 +82,7 @@ function isValidObjectMaxDepth(maxDepth) {
* Since data will be parsed statically during a build step, some restrictions
* are applied with respect to how minErr instances are created and called.
* Instances should have names of the form namespaceMinErr for a minErr created
* using minErr('namespace') . Error codes, namespaces and template strings
* using minErr('namespace'). Error codes, namespaces and template strings
* should all be static strings, not variables or general expressions.
*
* @param {string} module The namespace to use for the new minErr instance.
+1 -1
View File
@@ -1,6 +1,6 @@
/**
* @license AngularJS v"NG_VERSION_FULL"
* (c) 2010-2018 Google, Inc. http://angularjs.org
* (c) 2010-2020 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, angular) {
+34 -33
View File
@@ -205,7 +205,7 @@
*
* This example show how you might use `$doCheck` to trigger changes in your component's inputs even if the
* actual identity of the component doesn't change. (Be aware that cloning and deep equality checks on large
* arrays or objects can have a negative impact on your application performance)
* arrays or objects can have a negative impact on your application performance.)
*
* <example name="doCheckArrayExample" module="do-check-module">
* <file name="index.html">
@@ -528,7 +528,7 @@
* would result in the whole app "stalling" until all templates are loaded asynchronously - even in the
* case when only one deeply nested directive has `templateUrl`.
*
* Template loading is asynchronous even if the template has been preloaded into the {@link $templateCache}
* Template loading is asynchronous even if the template has been preloaded into the {@link $templateCache}.
*
* You can specify `templateUrl` as a string representing the URL or as a function which takes two
* arguments `tElement` and `tAttrs` (described in the `compile` function api below) and returns
@@ -589,7 +589,7 @@
* own templates or compile functions. Compiling these directives results in an infinite loop and
* stack overflow errors.
*
* This can be avoided by manually using $compile in the postLink function to imperatively compile
* This can be avoided by manually using `$compile` in the postLink function to imperatively compile
* a directive's template instead of relying on automatic template compilation via `template` or
* `templateUrl` declaration or manual compilation inside the compile function.
* </div>
@@ -693,17 +693,17 @@
*
* * `true` - transclude the content (i.e. the child nodes) of the directive's element.
* * `'element'` - transclude the whole of the directive's element including any directives on this
* element that defined at a lower priority than this directive. When used, the `template`
* element that are defined at a lower priority than this directive. When used, the `template`
* property is ignored.
* * **`{...}` (an object hash):** - map elements of the content onto transclusion "slots" in the template.
*
* **Mult-slot transclusion** is declared by providing an object for the `transclude` property.
* **Multi-slot transclusion** is declared by providing an object for the `transclude` property.
*
* This object is a map where the keys are the name of the slot to fill and the value is an element selector
* used to match the HTML to the slot. The element selector should be in normalized form (e.g. `myElement`)
* and will match the standard element variants (e.g. `my-element`, `my:element`, `data-my-element`, etc).
*
* For further information check out the guide on {@link guide/directive#matching-directives Matching Directives}
* For further information check out the guide on {@link guide/directive#matching-directives Matching Directives}.
*
* If the element selector is prefixed with a `?` then that slot is optional.
*
@@ -728,7 +728,7 @@
* </div>
*
* If you want to manually control the insertion and removal of the transcluded content in your directive
* then you must use this transclude function. When you call a transclude function it returns a a jqLite/JQuery
* then you must use this transclude function. When you call a transclude function it returns a jqLite/JQuery
* object that contains the compiled DOM, which is linked to the correct transclusion scope.
*
* When you call a transclusion function you can pass in a **clone attach function**. This function accepts
@@ -813,8 +813,8 @@
* The {@link ng.$compile.directive.Attributes Attributes} object - passed as a parameter in the
* `link()` or `compile()` functions. It has a variety of uses.
*
* * *Accessing normalized attribute names:* Directives like 'ngBind' can be expressed in many ways:
* 'ng:bind', `data-ng-bind`, or 'x-ng-bind'. The attributes object allows for normalized access
* * *Accessing normalized attribute names:* Directives like `ngBind` can be expressed in many ways:
* `ng:bind`, `data-ng-bind`, or `x-ng-bind`. The attributes object allows for normalized access
* to the attributes.
*
* * *Directive inter-communication:* All directives share the same instance of the attributes
@@ -855,25 +855,24 @@
<file name="index.html">
<script>
angular.module('compileExample', [], function($compileProvider) {
// configure new 'compile' directive by passing a directive
// factory function. The factory function injects the '$compile'
// Configure new 'compile' directive by passing a directive
// factory function. The factory function injects '$compile'.
$compileProvider.directive('compile', function($compile) {
// directive factory creates a link function
// The directive factory creates a link function.
return function(scope, element, attrs) {
scope.$watch(
function(scope) {
// watch the 'compile' expression for changes
// Watch the 'compile' expression for changes.
return scope.$eval(attrs.compile);
},
function(value) {
// when the 'compile' expression changes
// assign it into the current DOM
// When the 'compile' expression changes
// assign it into the current DOM.
element.html(value);
// compile the new DOM and link it to the current
// scope.
// NOTE: we only compile .childNodes so that
// we don't get into infinite loop compiling ourselves
// Compile the new DOM and link it to the current scope.
// NOTE: we only compile '.childNodes' so that we
// don't get into an infinite loop compiling ourselves.
$compile(element.contents())(scope);
}
);
@@ -946,13 +945,13 @@
* }
* ```
* * `futureParentElement` - defines the parent to which the `cloneAttachFn` will add
* the cloned elements; only needed for transcludes that are allowed to contain non html
* elements (e.g. SVG elements). See also the directive.controller property.
* the cloned elements; only needed for transcludes that are allowed to contain non HTML
* elements (e.g. SVG elements). See also the `directive.controller` property.
*
* Calling the linking function returns the element of the template. It is either the original
* element passed in, or the clone of the element if the `cloneAttachFn` is provided.
*
* After linking the view is not updated until after a call to $digest which typically is done by
* After linking the view is not updated until after a call to `$digest`, which typically is done by
* AngularJS automatically.
*
* If you need access to the bound view, there are two ways to do it:
@@ -960,21 +959,23 @@
* - If you are not asking the linking function to clone the template, create the DOM element(s)
* before you send them to the compiler and keep this reference around.
* ```js
* var element = $compile('<p>{{total}}</p>')(scope);
* var element = angular.element('<p>{{total}}</p>');
* $compile(element)(scope);
* ```
*
* - if on the other hand, you need the element to be cloned, the view reference from the original
* example would not point to the clone, but rather to the original template that was cloned. In
* this case, you can access the clone via the cloneAttachFn:
* this case, you can access the clone either via the `cloneAttachFn` or the value returned by the
* linking function:
* ```js
* var templateElement = angular.element('<p>{{total}}</p>'),
* scope = ....;
*
* var templateElement = angular.element('<p>{{total}}</p>');
* var clonedElement = $compile(templateElement)(scope, function(clonedElement, scope) {
* //attach the clone to DOM document at the right place
* // Attach the clone to DOM document at the right place.
* });
*
* //now we have reference to the cloned DOM via `clonedElement`
* // Now we have reference to the cloned DOM via `clonedElement`.
* // NOTE: The `clonedElement` returned by the linking function is the same as the
* // `clonedElement` passed to `cloneAttachFn`.
* ```
*
*
@@ -1025,7 +1026,7 @@
*
* When the original node and the replace template declare the same directive(s), they will be
* {@link guide/compiler#double-compilation-and-how-to-avoid-it compiled twice} because the compiler
* does not deduplicate them. In many cases, this is not noticable, but e.g. {@link ngModel} will
* does not deduplicate them. In many cases, this is not noticeable, but e.g. {@link ngModel} will
* attach `$formatters` and `$parsers` twice.
*
* See issue [#2573](https://github.com/angular/angular.js/issues/2573).
@@ -1500,9 +1501,9 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
* @description
* Register a new directive with the compiler.
*
* @param {string|Object} name Name of the directive in camel-case (i.e. <code>ngBind</code> which
* will match as <code>ng-bind</code>), or an object map of directives where the keys are the
* names and the values are the factories.
* @param {string|Object} name Name of the directive in camel-case (i.e. `ngBind` which will match
* as `ng-bind`), or an object map of directives where the keys are the names and the values
* are the factories.
* @param {Function|Array} directiveFactory An injectable directive factory function. See the
* {@link guide/directive directive guide} and the {@link $compile compile API} for more info.
* @returns {ng.$compileProvider} Self for chaining.
+1 -8
View File
@@ -54,14 +54,7 @@
var ngStyleDirective = ngDirective(function(scope, element, attr) {
scope.$watchCollection(attr.ngStyle, function ngStyleWatchAction(newStyles, oldStyles) {
if (oldStyles && (newStyles !== oldStyles)) {
if (!newStyles) {
newStyles = {};
}
forEach(oldStyles, function(val, style) {
if (newStyles[style] == null) {
newStyles[style] = '';
}
});
forEach(oldStyles, function(val, style) { element.css(style, ''); });
}
if (newStyles) element.css(newStyles);
});
+8 -2
View File
@@ -68,15 +68,21 @@ var requiredDirective = ['$parse', function($parse) {
require: '?ngModel',
link: function(scope, elm, attr, ctrl) {
if (!ctrl) return;
var value = attr.required || $parse(attr.ngRequired)(scope);
// For boolean attributes like required, presence means true
var value = attr.hasOwnProperty('required') || $parse(attr.ngRequired)(scope);
attr.required = true; // force truthy in case we are on non input element
if (!attr.ngRequired) {
// force truthy in case we are on non input element
// (input elements do this automatically for boolean attributes like required)
attr.required = true;
}
ctrl.$validators.required = function(modelValue, viewValue) {
return !value || !ctrl.$isEmpty(viewValue);
};
attr.$observe('required', function(newVal) {
if (value !== newVal) {
value = newVal;
ctrl.$validate();
-1
View File
@@ -155,7 +155,6 @@ function $AriaProvider() {
* @name $aria
*
* @description
* @priority 200
*
* The $aria service contains helper methods for applying common
* [ARIA](http://www.w3.org/TR/wai-aria/) attributes to HTML directives.
+13
View File
@@ -814,6 +814,19 @@ describe('angular', function() {
expect(isElement(dst.jqObject)).toBeTruthy();
expect(dst.jqObject.nodeName).toBeUndefined(); // i.e it is a jqLite/jQuery object
});
it('should not merge the __proto__ property', function() {
var src = JSON.parse('{ "__proto__": { "xxx": "polluted" } }');
var dst = {};
merge(dst, src);
if (typeof dst.__proto__ !== 'undefined') { // eslint-disable-line
// Should not overwrite the __proto__ property or pollute the Object prototype
expect(dst.__proto__).toBe(Object.prototype); // eslint-disable-line
}
expect(({}).xxx).toBeUndefined();
});
});
+11
View File
@@ -143,6 +143,17 @@ describe('ngStyle', function() {
expect(element.css(postCompStyle)).not.toBe('99px');
});
it('should clear style when the value is false', function() {
scope.styleObj = {'height': '99px', 'width': '88px'};
scope.$apply();
expect(element.css(preCompStyle)).toBe('88px');
expect(element.css(postCompStyle)).toBe('99px');
scope.styleObj = {'height': false, 'width': false};
scope.$apply();
expect(element.css(preCompStyle)).not.toBe('88px');
expect(element.css(postCompStyle)).not.toBe('99px');
});
it('should set style when the value is zero', function() {
scope.styleObj = {'height': '99px', 'width': '88px'};
scope.$apply();
+1 -1
View File
@@ -349,7 +349,7 @@ describe('select', function() {
});
it('should only call selectCtrl.writeValue after a digest has occured', function() {
it('should only call selectCtrl.writeValue after a digest has occurred', function() {
scope.mySelect = 'B';
scope.$apply();
+18
View File
@@ -696,6 +696,13 @@ describe('validators', function() {
}));
it('should override "required" when ng-required="false" is set', function() {
var inputElm = helper.compileInput('<input type="text" ng-model="notDefined" required ng-required="false" />');
expect(inputElm).toBeValid();
});
it('should validate only once after compilation when inside ngRepeat', function() {
helper.compileInput(
'<div ng-repeat="input in [0]">' +
@@ -731,6 +738,7 @@ describe('validators', function() {
expect(helper.validationCounter.required).toBe(1);
});
it('should validate once when inside ngRepeat, and set the "required" error when ngRequired is false by default', function() {
$rootScope.isRequired = false;
$rootScope.refs = {};
@@ -744,5 +752,15 @@ describe('validators', function() {
expect($rootScope.refs.input.$error.required).toBeUndefined();
});
it('should validate only once when inside ngIf with required on non-input elements', inject(function($compile) {
$rootScope.value = '12';
$rootScope.refs = {};
helper.compileInput('<div ng-if="true"><span ng-model="value" ng-ref="refs.ctrl" ng-ref-read="ngModel" required validation-spy="required"></span></div>');
$rootScope.$digest();
expect(helper.validationCounter.required).toBe(1);
expect($rootScope.refs.ctrl.$error.required).not.toBe(true);
}));
});
});
+14 -14
View File
@@ -13,9 +13,9 @@
integrity sha1-vShOV8hPEyXacCur/IKlMoGQwMU=
"@types/selenium-webdriver@^3.0.0":
version "3.0.13"
resolved "https://registry.yarnpkg.com/@types/selenium-webdriver/-/selenium-webdriver-3.0.13.tgz#deb799c641773c5e367abafc92d1e733d62cddd7"
integrity sha512-rI0LGoMiZGUM+tjDakQpwZOvcmQoubiJ7hxqrYU12VRxBuGGvOThxrBOU/QmJKlKg1WG6FMzuvcEyLffvVSsmw==
version "3.0.12"
resolved "https://registry.yarnpkg.com/@types/selenium-webdriver/-/selenium-webdriver-3.0.12.tgz#6affe5aed1ba379175075a889adbe2bc3aa62159"
integrity sha512-hYn+eoOehVUIdMwp5h34ZsGAO1ydja10GDup4BwyoFCdcH5MQ35nQq+AInSaBMEMopD5hEooFCyKo2Pajbe1ag==
Base64@~0.2.0:
version "0.2.1"
@@ -4347,10 +4347,10 @@ jasminewd2@^2.1.0:
resolved "https://registry.yarnpkg.com/jquery/-/jquery-2.2.4.tgz#2c89d6889b5eac522a7eea32c14521559c6cbf02"
integrity sha1-LInWiJterFIqfuoywUUhVZxsvwI=
jquery@3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.2.1.tgz#5c4d9de652af6cd0a770154a631bba12b015c787"
integrity sha1-XE2d5lKvbNCncBVKYxu6ErAVx4c=
jquery@3.4.0:
version "3.4.0"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.4.0.tgz#8de513fa0fa4b2c7d2e48a530e26f0596936efdf"
integrity sha512-ggRCXln9zEqv6OqAGXFEcshF5dSBvCkzj6Gm2gzuR5fWawaX8t7cxKVkkygKODrDAzKdoYw3l/e3pm3vlT4IbQ==
js-tokens@^3.0.0:
version "3.0.1"
@@ -5440,10 +5440,10 @@ nanomatch@^1.2.9:
snapdragon "^0.8.1"
to-regex "^3.0.1"
natives@1.1.3, natives@^1.1.0:
version "1.1.3"
resolved "https://registry.yarnpkg.com/natives/-/natives-1.1.3.tgz#44a579be64507ea2d6ed1ca04a9415915cf75558"
integrity sha512-BZGSYV4YOLxzoTK73l0/s/0sH9l8SHs2ocReMH1f8JYSh5FUWu4ZrKCpJdRkWXV6HFR/pZDz7bwWOVAY07q77g==
natives@1.1.6, natives@^1.1.0:
version "1.1.6"
resolved "https://registry.yarnpkg.com/natives/-/natives-1.1.6.tgz#a603b4a498ab77173612b9ea1acdec4d980f00bb"
integrity sha512-6+TDFewD4yxY14ptjKaS63GVdtKiES1pTPyxn9Jb0rBqPMZ7VcCiooEhPNsr+mqHtMGxa/5c/HhcC4uPEUw/nA==
natural-compare@^1.4.0:
version "1.4.0"
@@ -5836,9 +5836,9 @@ pako@~0.2.0:
integrity sha1-8/dSL073gjSNqBYbrZ7P1Rv4OnU=
pako@~1.0.2:
version "1.0.7"
resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.7.tgz#2473439021b57f1516c82f58be7275ad8ef1bb27"
integrity sha512-3HNK5tW4x8o5mO8RuHZp3Ydw9icZXx0RANAOMzlMzx7LVXhMJ4mo3MOBpzyd7r/+RUu8BmndP47LXT+vzjtWcQ==
version "1.0.6"
resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.6.tgz#0101211baa70c4bca4a0f63f2206e97b7dfaf258"
integrity sha512-lQe48YPsMJAig+yngZ87Lus+NF+3mtu7DVOBu6b/gHO1YpKwIj5AWjZ/TOS7i46HD/UixzWb1zeWDZfGZ3iYcg==
param-case@^2.1.0:
version "2.1.0"