Commit Graph

108 Commits

Author SHA1 Message Date
Jeff Cross 903ff9047f feat(core): add ability to reflect DOM properties as attributes
By binding the token `DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES` provided by 
the dom_renderer module to `true` in the root injector (i.e. bootstrap()), 
all elements whose properties are set by angular will be reflected as 
attributes with the prefix "ng-reflect-".

Fixes #2910
2015-07-15 13:59:44 -07:00
Jacob MacDonald 4bdc91892a chore(transformer): add a test that generated change detectors dont call notifyOnBinding for template variables 2015-07-13 15:09:06 -07:00
Tobias Bosch b3a763a718 fix(compiler): keep `DOM.hasProperty` in sync between browser and transformer.
Right now, we always return true until
we have property schema support (#2014).

Fixes #2984
Closes #2981
2015-07-13 15:09:06 -07:00
Martin Probst 3bf8c18c56 chore: run clang-format on code base.
This fixes several minor indentation issues (instanceof precendence,
type declaration specificity, template string length calculation).

This should also fix some flip-flop situations with template strings.
2015-07-12 18:50:52 +02:00
Rado Kirov 749d043258 fix(css_shim): fixes multiple uses of polyfill-unscoped-rule. 2015-07-10 12:40:57 -07:00
Victor Berchet 447926dc08 refactor(RegExp): use /.../ to create RegExp literal
fixes #2691
2015-07-09 09:14:25 +02:00
Pawel Kozlowski 582551bea9 test(ProtoViewBuilder): correct duplicate tests
Closes #2860
2015-07-06 22:40:49 +02:00
Pawel Kozlowski cd65fc2a5e fix(compiler): detect and strip data- prefix from bindings
Fixes #2687

Closes #2719
2015-07-02 17:32:12 +02:00
Alex Eagle 27e710019c chore(typing): use types for DOM API
This is possible now that ts2dart special cases these for dart.

Fixes #2770
2015-07-01 09:57:11 -07:00
Alex Eagle 44891996b5 fix(build): add missing return types now enforced by linter 2015-06-29 15:31:41 -07:00
Victor Berchet 356c927d12 refactor(TemplateLoader): rename to ViewLoader 2015-06-24 18:40:04 +02:00
Victor Berchet b89c0672e6 test(refactor): cleanup test to use the new UrlMapper 2015-06-24 18:40:04 +02:00
Victor Berchet 3ea655918e refactor(Compiler): inline styles before compiling the template 2015-06-24 18:40:03 +02:00
Tobias Bosch ba9fecd068 refactor(render): use `RenderElementRef` in all renderer methods
BREAKING CHANGES:
- Almost all methods in `Renderer` now take a `RenderElementRef` instead
  of a `ViewRef` + `boundElementIndex`.
- These methods can be called with the `ElementRef` from the app side
  directly.

Closes #2706
Related to #2476
2015-06-23 14:26:34 -07:00
Tobias Bosch 0a51ccbd68 feat(render): don’t use the reflector for setting properties
BREAKING CHANGES:
- host actions don't take an expression as value any more but only a method name,
  and assumes to get an array via the EventEmitter with the method arguments.
- Renderer.setElementProperty does not take `style.`/... prefixes any more.
  Use the new methods `Renderer.setElementAttribute`, ... instead

Part of #2476
Closes #2637
2015-06-22 18:35:16 -07:00
vsavkin 92ffc465d6 feat(host): limits host properties to renames 2015-06-22 12:10:02 -07:00
Pawel Kozlowski d7b9345b6d feat(compiler): detect dangling property bindings
BREAKING CHANGE: compiler will throw on binding to non-existing properties.

Till now it was possible to have a binding to a non-existing property,
ex.: `<div [foo]="exp">`. From now on this is compilation error - any
property binding needs to have at least one associated property:
eaither on an HTML element or on any directive associated with a
given element (directives' properites need to be declared using the
`properties` field in the `@Directive` / `@Component` annotation).

Closes #2598
2015-06-20 08:06:07 +02:00
Yegor Jbanov f158fbd131 chore(ShadowDomStrategy): fix MapWrapper usage, DemoUrlResolver 2015-06-19 18:50:30 -07:00
Victor Berchet 1c4d233fe7 fix(ShadowDomStrategy): always inline import rules
fixes #1694
2015-06-19 18:50:30 -07:00
vsavkin 20a8f0dbe5 refactor(pipes): removed pipes from properties
BREAKING CHANGE:

This PR remove an ability to use pipes in the properties config. Instead, inject the pipe registry.
2015-06-19 16:56:52 -07:00
Tobias Bosch 9d4111d69d fix(compiler): make text interpolation more robust
Allows to add or remove previous siblings of text
interpolations (e.g. by added `<script>` tags for
content reproduction, or by removed `<style>` tags).

Also calculates correctly whether an element is
empty.

Fixes #2591
2015-06-18 15:45:00 -07:00
Tobias Bosch 180e617866 Revert "fix(Compiler): fix text nodes after content tags"
This reverts commit d599fd3434.
but keeps the integration test. The test is made green by the
following commits.
2015-06-18 15:45:00 -07:00
Martin Probst dfd30910aa feat: remove MapWrapper.contains(). 2015-06-18 14:55:12 -07:00
Martin Probst be7ac9fd41 feat: remove MapWrapper.create()/get()/set().
Better dart2js code, better Angular code.
2015-06-18 14:55:12 -07:00
Martin Probst c7e48350d3 chore: kill ListWrapper.create() and .push().
These wrappers are not natively understood by
ts2dart. Removing them will improve Dart2JS
compilation due to fewer megamorphic calls to List
functions.

It also makes Angular code more succinct and
improves type safety in Angular due to better type
inference of the Array component type.

This change exposed several bugs in Angular.
2015-06-17 16:21:55 -07:00
Tobias Bosch 5dee8e26cc fix(views): remove dynamic component views, free host views, free embedded views
Closes #2472
Closes #2339

BREAKING CHANGE
- `Compiler.compile` has been removed, the only way to compile
  components dynamically is via `Compiler.compileInHost`
- `DynamicComponentLoader.loadIntoExistingLocation` has changed:
  * renamed into `loadIntoLocation`
  * will always create the host element as well
  * requires an element with a variable inside of the host component view
    next to which it will load new component.
- `DynamicComponentLoader.loadNextToExistingLocation` was renamed into
  `DynamicComponentLoader.loadNextToLocation`
- `DynamicComponentLoader.loadIntoNewLocation` is removed
  * use `DynamicComponentLoader.loadNextToLocation` instead
    and then move the view nodes
    manually around via `DomRenderer.getRootNodes()`
- `AppViewManager.{create,destroy}Free{Host,Embedded}View` was removed
  * use `AppViewManager.createViewInContainer` and then move the view nodes
    manually around via `DomRenderer.getRootNodes()`
- `Renderer.detachFreeView` was removed. Use `DomRenderer.getRootNodes()`
  to get the root nodes of a view and detach them manually.
2015-06-17 11:33:51 -07:00
Victor Berchet 91c75f99fe refactor(ShadowDomStrategy): remove unused imports in test 2015-06-16 17:41:32 +02:00
Victor Berchet 6e38515402 fix(ShadowDom): fix emulation integration spec to test all 3 strategies
fixes #2546
2015-06-16 17:38:42 +02:00
Victor Berchet d599fd3434 fix(Compiler): fix text nodes after content tags
fixes #2095
2015-06-16 17:38:42 +02:00
Pawel Kozlowski 7a41b19e58 test(PropertySetterFactory): add more tests
There are upcoming changes to the way we generate
and verify setters so more test are needed to cover
all the corner cases that are being handled today.

Closes #2559
2015-06-16 14:49:59 +02:00
Tobias Bosch 9bad70be5e fix(selector): select by attribute independent of value and order
Closes #2513
2015-06-15 12:10:11 -07:00
Victor Berchet ac3e624d0f feat(View): add support for styleUrls and styles
fixes #2382
2015-06-15 19:35:16 +02:00
Martin Probst f3d741854a fix: add types for ts2dart's façade handling.
... in many, many places.
2015-06-12 15:41:08 -07:00
Victor Berchet b4e82b8bc7 fix(DirectiveMetadata): add support for events, changeDetection 2015-06-12 19:05:51 +02:00
Martin Probst a6e7123995 feat: adjust formatting for clang-format v1.0.19. 2015-06-12 09:51:57 -07:00
Tobias Bosch ca09701343 perf(render): only create `LightDom` instances if the element has children 2015-06-11 14:45:44 -07:00
Tobias Bosch 4f27611ae6 perf(render): don't create property setters if not needed 2015-06-11 14:45:44 -07:00
Victor Berchet f3b49378e4 feat(Directive): Have a single Directive.host which mimics HTML
fixes #2268

BREAKING CHANGE:

Before

    @Directive({
      hostListeners: {'event': 'statement'},
      hostProperties: {'expression': 'hostProp'},
      hostAttributes: {'attr': 'value'},
      hostActions: {'action': 'statement'}
    })

After

    @Directive({
      host: {
        '(event)': 'statement',
        '[hostProp]': 'expression'  // k & v swapped
        'attr': 'value',
        '@action': 'statement'
      }
    })
2015-06-11 13:11:09 -07:00
Victor Berchet 6ca81fb98c refactor(ProtoViewDto): switch to enum 2015-06-11 17:11:34 +02:00
Rado Kirov 92d565848b fix(shadow_dom): moves the imported nodes into the correct location. 2015-06-10 13:50:12 -07:00
Jeff Cross f34f8df319 refactor(xhr): move render's xhr implementation to render/
The existence of this module in the services/ folder led some to believe xhr
is meant to be a general-purpose http library.

Fixes #2305
2015-06-09 10:28:35 -07:00
Tobias Bosch 87b3b718e3 refactor(render): don’t use a global cache for property setters
Related to #2359
2015-06-05 13:11:23 -07:00
vsavkin 69b75b7fd8 feat(view): added support for exportAs, so any directive can be assigned to a variable 2015-06-04 14:14:03 -07:00
Tobias Bosch 827841ec5b refactor(render): add `DomElement`
Replaces the multiple arrays of `DomView`
by a single array with `DomElement`s.

Note: this commit does not show a performance regression
(tested against the tree benchmark locally).
2015-06-04 11:44:26 -07:00
Martin Probst f999d5a156 chore: move to clang-format 1.0.17.
clang-format 1.0.17 substantially improves formatting for fat arrow functions
and array literal detection. It also fixes a number of minor formatting issues.
2015-06-03 15:27:27 -07:00
Tobias Bosch 5030ffb01c feat(view): introduce free embedded views
Free embedded views are view instances that are created
logically in the same was as views of a ViewContainer,
but their dom nodes are not attached.

BREAKING CHANGE:

- `Renderer.detachFreeHostView` was renamed to
  `Renderer.detachFreeView`
- `DomRenderer.getHostElement()` was generalized into
  `DomRenderer.getRootNodes()`
2015-06-03 14:42:00 -07:00
Tobias Bosch ba7956f521 fix(render): only look for content tags in views that might have them.
Largetable benchmark with `interpolationAttr` and 200 rows / 20 columns:
Time for destroy/create pair dropped from about 1260ms to about 150ms.

Related to #2298, but does not really fix it as we are still slow
if people are using `<content>`.

Closes #2297
2015-06-02 15:31:07 -07:00
Marc Laval 4c8e11a577 fix(ShadowCss): keyframes tests failing in Safari
Closes #2283
2015-06-02 19:23:06 +02:00
Victor Berchet c60091b949 refactor(Compiler): improve the error message on component load error
by adding the fetched url.

relates to #1460
2015-06-02 12:59:50 +02:00
Tobias Bosch 62a95823e0 fix(selector): support multiple `:not` clauses
Fixes #2243
2015-06-01 14:24:19 -07:00