angular-cn/packages
JoostK 1a7a7360b0 fix(compiler): properly associate source spans for implicitly closed elements (#38126)
HTML is very lenient when it comes to closing elements, so Angular's parser has
rules that specify which elements are implicitly closed when closing a tag.
The parser keeps track of the nesting of tag names using a stack and parsing
a closing tag will pop as many elements off the stack as possible, provided
that the elements can be implicitly closed.

For example, consider the following templates:

- `<div><br></div>`, the `<br>` is implicitly closed when parsing `</div>`,
  because `<br>` is a void element.
- `<div><p></div>`, the `<p>` is implicitly closed when parsing `</div>`,
  as `<p>` is allowed to be closed by the closing of its parent element.
- `<ul><li>A <li>B</ul>`, the first `<li>` is implicitly closed when parsing
  the second `<li>`, whereas the second `<li>` would be implicitly closed when
  parsing the `</ul>`.

In all the cases above the parsed structure would be correct, however the source
span of the closing `</div>` would incorrectly be assigned to the element that
is implicitly closed. The problem was that closing an element would associate
the source span with the element at the top of the stack, however this may not
be the element that is actually being closed if some elements would be
implicitly closed.

This commit fixes the issue by assigning the end source span with the element
on the stack that is actually being closed. Any implicitly closed elements that
are popped off the stack will not be assigned an end source span, as the
implicit closing implies that no ending element is present.

Note that there is a difference between self-closed elements such as `<input/>`
and implicitly closed elements such as `<input>`. The former does have an end
source span (identical to its start source span) whereas the latter does not.

Fixes #36118
Resolves FW-2004

PR Close #38126
2020-07-20 10:02:06 -07:00
..
animations Revert "build: remove wombot proxy registry from package.jsons for release (#37378)" (#37495) 2020-06-10 08:21:45 -07:00
bazel Revert "build: remove obsolete Bazel function ctx.new_file (#38080)" (#38101) 2020-07-16 11:06:23 -07:00
benchpress build: add wombot proxy for publish config for @angular/benchpress (#37752) 2020-06-25 17:08:18 -07:00
common fix(http): avoid abort a request when fetch operation is completed (#37367) 2020-06-25 12:09:39 -07:00
compiler fix(compiler): properly associate source spans for implicitly closed elements (#38126) 2020-07-20 10:02:06 -07:00
compiler-cli fix(core): incorrectly validating properties on ng-content and ng-container (#37773) 2020-07-15 12:39:39 -07:00
core fix(core): error due to integer overflow when there are too many host bindings (#38014) 2020-07-17 12:58:15 -07:00
docs docs(di): fix typo in advanced di doc (#36634) 2020-05-01 09:50:28 -07:00
elements fix(elements): fire custom element output events during component initialization (#37570) 2020-06-29 10:33:40 -07:00
examples feat(zone.js): upgrade zone.js to angular package format(APF) (#36540) 2020-06-11 11:08:48 -07:00
forms refactor(forms): remove unnecessary `!` operators from validators (#36805) 2020-07-14 11:01:53 -07:00
language-service build(language-service): add script to build package locally (#38103) 2020-07-16 16:39:54 -07:00
localize feat(localize): allow duplicate messages to be handled during extraction (#38082) 2020-07-16 13:53:38 -07:00
misc/angular-in-memory-web-api build: import in-memory-web-api project (#37182) 2020-06-15 14:28:37 -07:00
platform-browser docs: update api ref doc for platform browser (#37186) 2020-06-11 18:59:12 -07:00
platform-browser-dynamic Revert "build: remove wombot proxy registry from package.jsons for release (#37378)" (#37495) 2020-06-10 08:21:45 -07:00
platform-server feat(platform-server): add option for absolute URL HTTP support (#37539) 2020-06-25 14:26:09 -07:00
platform-webworker Revert "build: remove wombot proxy registry from package.jsons for release (#37378)" (#37495) 2020-06-10 08:21:45 -07:00
platform-webworker-dynamic Revert "build: remove wombot proxy registry from package.jsons for release (#37378)" (#37495) 2020-06-10 08:21:45 -07:00
private/testing build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
router docs: update router api documentation (#37980) 2020-07-16 13:52:40 -07:00
service-worker docs(service-worker): fix typos in `SwRegistrationOptions` API docs (#38047) 2020-07-15 13:10:25 -07:00
upgrade Revert "build: remove wombot proxy registry from package.jsons for release (#37378)" (#37495) 2020-06-10 08:21:45 -07:00
zone.js feat(dev-infra): add bazel firefox browser with RBE compatibility (#38029) 2020-07-15 12:34:05 -07:00
BUILD.bazel
README.md
circular-deps-test.conf.js build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
empty.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
goog.d.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
license-banner.txt
system.d.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
tsconfig-build-no-strict.json
tsconfig-build.json
tsconfig-test.json
tsconfig.json build: import in-memory-web-api project (#37182) 2020-06-15 14:28:37 -07:00
types.d.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00

README.md

Angular

The sources for this package are in the main Angular repo. Please file issues and pull requests against that repo.

Usage information and reference details can be found in Angular documentation.

License: MIT