@angular/cdk 7.2.0 → 7.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/LICENSE +1 -1
  2. package/_a11y.scss +1 -1
  3. package/a11y/typings/focus-monitor/focus-monitor.d.ts +0 -1
  4. package/a11y/typings/focus-trap/focus-trap.d.ts +2 -0
  5. package/a11y/typings/index.metadata.json +1 -1
  6. package/bundles/cdk-a11y.umd.js +23 -22
  7. package/bundles/cdk-a11y.umd.js.map +1 -1
  8. package/bundles/cdk-a11y.umd.min.js +1 -1
  9. package/bundles/cdk-a11y.umd.min.js.map +1 -1
  10. package/bundles/cdk-coercion.umd.js +20 -4
  11. package/bundles/cdk-coercion.umd.js.map +1 -1
  12. package/bundles/cdk-coercion.umd.min.js +1 -1
  13. package/bundles/cdk-coercion.umd.min.js.map +1 -1
  14. package/bundles/cdk-drag-drop.umd.js +43 -21
  15. package/bundles/cdk-drag-drop.umd.js.map +1 -1
  16. package/bundles/cdk-drag-drop.umd.min.js +2 -2
  17. package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
  18. package/bundles/cdk-observers.umd.js +1 -1
  19. package/bundles/cdk-observers.umd.js.map +1 -1
  20. package/bundles/cdk-observers.umd.min.js +1 -1
  21. package/bundles/cdk-observers.umd.min.js.map +1 -1
  22. package/bundles/cdk-overlay.umd.js +9 -19
  23. package/bundles/cdk-overlay.umd.js.map +1 -1
  24. package/bundles/cdk-overlay.umd.min.js +2 -2
  25. package/bundles/cdk-overlay.umd.min.js.map +1 -1
  26. package/bundles/cdk-text-field.umd.js +6 -6
  27. package/bundles/cdk-text-field.umd.js.map +1 -1
  28. package/bundles/cdk-text-field.umd.min.js +1 -1
  29. package/bundles/cdk-text-field.umd.min.js.map +1 -1
  30. package/bundles/cdk-tree.umd.js.map +1 -1
  31. package/bundles/cdk-tree.umd.min.js.map +1 -1
  32. package/bundles/cdk.umd.js +1 -1
  33. package/bundles/cdk.umd.js.map +1 -1
  34. package/bundles/cdk.umd.min.js +1 -1
  35. package/bundles/cdk.umd.min.js.map +1 -1
  36. package/coercion/typings/element.d.ts +13 -0
  37. package/coercion/typings/index.metadata.json +1 -1
  38. package/coercion/typings/public-api.d.ts +1 -0
  39. package/drag-drop/typings/directives/drag.d.ts +5 -4
  40. package/drag-drop/typings/drag-ref.d.ts +2 -2
  41. package/drag-drop/typings/index.metadata.json +1 -1
  42. package/esm2015/a11y.js +23 -18
  43. package/esm2015/a11y.js.map +1 -1
  44. package/esm2015/cdk.js +1 -1
  45. package/esm2015/cdk.js.map +1 -1
  46. package/esm2015/coercion.js +18 -1
  47. package/esm2015/coercion.js.map +1 -1
  48. package/esm2015/drag-drop.js +37 -19
  49. package/esm2015/drag-drop.js.map +1 -1
  50. package/esm2015/observers.js +2 -2
  51. package/esm2015/observers.js.map +1 -1
  52. package/esm2015/overlay.js +11 -15
  53. package/esm2015/overlay.js.map +1 -1
  54. package/esm2015/text-field.js +3 -3
  55. package/esm2015/text-field.js.map +1 -1
  56. package/esm2015/tree.js.map +1 -1
  57. package/esm5/a11y.es5.js +24 -23
  58. package/esm5/a11y.es5.js.map +1 -1
  59. package/esm5/cdk.es5.js +1 -1
  60. package/esm5/cdk.es5.js.map +1 -1
  61. package/esm5/coercion.es5.js +18 -1
  62. package/esm5/coercion.es5.js.map +1 -1
  63. package/esm5/drag-drop.es5.js +43 -21
  64. package/esm5/drag-drop.es5.js.map +1 -1
  65. package/esm5/observers.es5.js +2 -2
  66. package/esm5/observers.es5.js.map +1 -1
  67. package/esm5/overlay.es5.js +11 -21
  68. package/esm5/overlay.es5.js.map +1 -1
  69. package/esm5/text-field.es5.js +3 -3
  70. package/esm5/text-field.es5.js.map +1 -1
  71. package/esm5/tree.es5.js.map +1 -1
  72. package/overlay/typings/index.metadata.json +1 -1
  73. package/overlay/typings/overlay-directives.d.ts +0 -2
  74. package/package.json +4 -4
  75. package/text-field/typings/index.metadata.json +1 -1
  76. package/tree/typings/control/base-tree-control.d.ts +1 -1
  77. package/tree/typings/control/nested-tree-control.d.ts +2 -2
  78. package/tree/typings/control/tree-control.d.ts +1 -1
  79. package/typings/a11y/focus-monitor/focus-monitor.d.ts +0 -1
  80. package/typings/a11y/focus-trap/focus-trap.d.ts +2 -0
  81. package/typings/a11y/index.metadata.json +1 -1
  82. package/typings/coercion/element.d.ts +13 -0
  83. package/typings/coercion/index.metadata.json +1 -1
  84. package/typings/coercion/public-api.d.ts +1 -0
  85. package/typings/drag-drop/directives/drag.d.ts +5 -4
  86. package/typings/drag-drop/drag-ref.d.ts +2 -2
  87. package/typings/drag-drop/index.metadata.json +1 -1
  88. package/typings/esm5/a11y/focus-monitor/focus-monitor.d.ts +0 -1
  89. package/typings/esm5/a11y/focus-trap/focus-trap.d.ts +2 -0
  90. package/typings/esm5/a11y/index.metadata.json +1 -1
  91. package/typings/esm5/coercion/element.d.ts +13 -0
  92. package/typings/esm5/coercion/index.metadata.json +1 -1
  93. package/typings/esm5/coercion/public-api.d.ts +1 -0
  94. package/typings/esm5/drag-drop/directives/drag.d.ts +5 -4
  95. package/typings/esm5/drag-drop/drag-ref.d.ts +2 -2
  96. package/typings/esm5/drag-drop/index.metadata.json +1 -1
  97. package/typings/esm5/index.metadata.json +1 -1
  98. package/typings/esm5/overlay/index.metadata.json +1 -1
  99. package/typings/esm5/overlay/overlay-directives.d.ts +0 -2
  100. package/typings/esm5/text-field/index.metadata.json +1 -1
  101. package/typings/esm5/tree/control/base-tree-control.d.ts +1 -1
  102. package/typings/esm5/tree/control/nested-tree-control.d.ts +2 -2
  103. package/typings/esm5/tree/control/tree-control.d.ts +1 -1
  104. package/typings/index.metadata.json +1 -1
  105. package/typings/overlay/index.metadata.json +1 -1
  106. package/typings/overlay/overlay-directives.d.ts +0 -2
  107. package/typings/text-field/index.metadata.json +1 -1
  108. package/typings/tree/control/base-tree-control.d.ts +1 -1
  109. package/typings/tree/control/nested-tree-control.d.ts +2 -2
  110. package/typings/tree/control/tree-control.d.ts +1 -1
package/esm5/cdk.es5.js CHANGED
@@ -15,7 +15,7 @@ import { Version } from '@angular/core';
15
15
  * Current version of the Angular Component Development Kit.
16
16
  * @type {?}
17
17
  */
18
- var VERSION = new Version('7.2.0');
18
+ var VERSION = new Version('7.2.1');
19
19
 
20
20
  /**
21
21
  * @fileoverview added by tsickle
@@ -1 +1 @@
1
- {"version":3,"file":"cdk.es5.js","sources":["../../src/cdk/version.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('7.2.0');\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAWA,AAAA,IAAa,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB,CAAC;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"cdk.es5.js","sources":["../../src/cdk/version.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('7.2.1');\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAWA,AAAA,IAAa,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB,CAAC;;;;;;;;;;;;;;"}
@@ -5,6 +5,8 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
+ import { ElementRef } from '@angular/core';
9
+
8
10
  /**
9
11
  * @fileoverview added by tsickle
10
12
  * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -78,6 +80,21 @@ function coerceCssPixelValue(value) {
78
80
  return typeof value === 'string' ? value : value + "px";
79
81
  }
80
82
 
83
+ /**
84
+ * @fileoverview added by tsickle
85
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
86
+ */
87
+ /**
88
+ * Coerces an ElementRef or an Element into an element.
89
+ * Useful for APIs that can accept either a ref or the native element itself.
90
+ * @template T
91
+ * @param {?} elementOrRef
92
+ * @return {?}
93
+ */
94
+ function coerceElement(elementOrRef) {
95
+ return elementOrRef instanceof ElementRef ? elementOrRef.nativeElement : elementOrRef;
96
+ }
97
+
81
98
  /**
82
99
  * @fileoverview added by tsickle
83
100
  * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -88,5 +105,5 @@ function coerceCssPixelValue(value) {
88
105
  * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
89
106
  */
90
107
 
91
- export { coerceBooleanProperty, coerceNumberProperty, _isNumberValue, coerceArray, coerceCssPixelValue };
108
+ export { coerceBooleanProperty, coerceNumberProperty, _isNumberValue, coerceArray, coerceCssPixelValue, coerceElement };
92
109
  //# sourceMappingURL=coercion.es5.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"coercion.es5.js","sources":["../../../src/cdk/coercion/css-pixel-value.ts","../../../src/cdk/coercion/array.ts","../../../src/cdk/coercion/number-property.ts","../../../src/cdk/coercion/boolean-property.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/** Coerces a value to a CSS pixel value. */\nexport function coerceCssPixelValue(value: any): string {\n if (value == null) {\n return '';\n }\n\n return typeof value === 'string' ? value : `${value}px`;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/** Wraps the provided value in an array, unless the provided value is an array. */\nexport function coerceArray<T>(value: T | T[]): T[] {\n return Array.isArray(value) ? value : [value];\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/** Coerces a data-bound value (typically a string) to a number. */\nexport function coerceNumberProperty(value: any): number;\nexport function coerceNumberProperty<D>(value: any, fallback: D): number | D;\nexport function coerceNumberProperty(value: any, fallbackValue = 0) {\n return _isNumberValue(value) ? Number(value) : fallbackValue;\n}\n\n/**\n * Whether the provided value is considered a number.\n * @docs-private\n */\nexport function _isNumberValue(value: any): boolean {\n // parseFloat(value) handles most of the cases we're interested in (it treats null, empty string,\n // and other non-number values as NaN, where Number just uses 0) but it considers the string\n // '123hello' to be a valid number. Therefore we also check if Number(value) is NaN.\n return !isNaN(parseFloat(value as any)) && !isNaN(Number(value));\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/** Coerces a data-bound value (typically a string) to a boolean. */\nexport function coerceBooleanProperty(value: any): boolean {\n return value != null && `${value}` !== 'false';\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AGSA,AAAA,SAAgB,qBAAqB,CAAC,KAAU,EAAhD;IACE,OAAO,KAAK,IAAI,IAAI,IAAI,EAA1B,GAA6B,KAAO,KAAK,OAAO,CAAC;CAChD;;;;;;;;;;;;ADAD,AAAA,SAAgB,oBAAoB,CAAC,KAAU,EAAE,aAAiB,EAAlE;IAAiD,IAAjD,aAAA,KAAA,KAAA,CAAA,EAAiD,EAAA,aAAjD,GAAA,CAAkE,CAAlE,EAAA;IACE,OAAO,cAAc,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,aAAa,CAAC;CAC9D;;;;;;;AAMD,AAAA,SAAgB,cAAc,CAAC,KAAU,EAAzC;;;;IAIE,OAAO,CAAC,KAAK,CAAC,UAAU,oBAAC,KAAK,GAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;CAClE;;;;;;;;;;;;;ADfD,AAAA,SAAgB,WAAW,CAAI,KAAc,EAA7C;IACE,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC;CAC/C;;;;;;;;;;;;ADFD,AAAA,SAAgB,mBAAmB,CAAC,KAAU,EAA9C;IACE,IAAI,KAAK,IAAI,IAAI,EAAE;QACjB,OAAO,EAAE,CAAC;KACX;IAED,OAAO,OAAO,KAAK,KAAK,QAAQ,GAAG,KAAK,GAAM,KAAK,GAArD,IAAyD,CAAC;CACzD;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"coercion.es5.js","sources":["../../../src/cdk/coercion/element.ts","../../../src/cdk/coercion/css-pixel-value.ts","../../../src/cdk/coercion/array.ts","../../../src/cdk/coercion/number-property.ts","../../../src/cdk/coercion/boolean-property.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {ElementRef} from '@angular/core';\n\n/**\n * Coerces an ElementRef or an Element into an element.\n * Useful for APIs that can accept either a ref or the native element itself.\n */\nexport function coerceElement<T>(elementOrRef: ElementRef<T> | T): T {\n return elementOrRef instanceof ElementRef ? elementOrRef.nativeElement : elementOrRef;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/** Coerces a value to a CSS pixel value. */\nexport function coerceCssPixelValue(value: any): string {\n if (value == null) {\n return '';\n }\n\n return typeof value === 'string' ? value : `${value}px`;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/** Wraps the provided value in an array, unless the provided value is an array. */\nexport function coerceArray<T>(value: T | T[]): T[] {\n return Array.isArray(value) ? value : [value];\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/** Coerces a data-bound value (typically a string) to a number. */\nexport function coerceNumberProperty(value: any): number;\nexport function coerceNumberProperty<D>(value: any, fallback: D): number | D;\nexport function coerceNumberProperty(value: any, fallbackValue = 0) {\n return _isNumberValue(value) ? Number(value) : fallbackValue;\n}\n\n/**\n * Whether the provided value is considered a number.\n * @docs-private\n */\nexport function _isNumberValue(value: any): boolean {\n // parseFloat(value) handles most of the cases we're interested in (it treats null, empty string,\n // and other non-number values as NaN, where Number just uses 0) but it considers the string\n // '123hello' to be a valid number. Therefore we also check if Number(value) is NaN.\n return !isNaN(parseFloat(value as any)) && !isNaN(Number(value));\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/** Coerces a data-bound value (typically a string) to a boolean. */\nexport function coerceBooleanProperty(value: any): boolean {\n return value != null && `${value}` !== 'false';\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AISA,AAAA,SAAgB,qBAAqB,CAAC,KAAU,EAAhD;IACE,OAAO,KAAK,IAAI,IAAI,IAAI,EAA1B,GAA6B,KAAO,KAAK,OAAO,CAAC;CAChD;;;;;;;;;;;;ADAD,AAAA,SAAgB,oBAAoB,CAAC,KAAU,EAAE,aAAiB,EAAlE;IAAiD,IAAjD,aAAA,KAAA,KAAA,CAAA,EAAiD,EAAA,aAAjD,GAAA,CAAkE,CAAlE,EAAA;IACE,OAAO,cAAc,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,aAAa,CAAC;CAC9D;;;;;;;AAMD,AAAA,SAAgB,cAAc,CAAC,KAAU,EAAzC;;;;IAIE,OAAO,CAAC,KAAK,CAAC,UAAU,oBAAC,KAAK,GAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;CAClE;;;;;;;;;;;;;ADfD,AAAA,SAAgB,WAAW,CAAI,KAAc,EAA7C;IACE,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC;CAC/C;;;;;;;;;;;;ADFD,AAAA,SAAgB,mBAAmB,CAAC,KAAU,EAA9C;IACE,IAAI,KAAK,IAAI,IAAI,EAAE;QACjB,OAAO,EAAE,CAAC;KACX;IAED,OAAO,OAAO,KAAK,KAAK,QAAQ,GAAG,KAAK,GAAM,KAAK,GAArD,IAAyD,CAAC;CACzD;;;;;;;;;;;;;ADDD,AAAA,SAAgB,aAAa,CAAI,YAA+B,EAAhE;IACE,OAAO,YAAY,YAAY,UAAU,GAAG,YAAY,CAAC,aAAa,GAAG,YAAY,CAAC;CACvF;;;;;;;;;;;;;;"}
@@ -701,13 +701,13 @@ DragRef = /** @class */ (function () {
701
701
  */
702
702
  this._boundaryElement = null;
703
703
  /**
704
- * Elements that can be used to drag the draggable item.
704
+ * Whether the native dragging interactions have been enabled on the root element.
705
705
  */
706
- this._handles = [];
706
+ this._nativeInteractionsEnabled = true;
707
707
  /**
708
- * Whether the native interactions on the element are enabled.
708
+ * Elements that can be used to drag the draggable item.
709
709
  */
710
- this._nativeInteractionsEnabled = true;
710
+ this._handles = [];
711
711
  this._disabled = false;
712
712
  /**
713
713
  * Emits as the drag sequence is being prepared.
@@ -895,7 +895,12 @@ DragRef = /** @class */ (function () {
895
895
  * @return {?}
896
896
  */
897
897
  function (value) {
898
- this._disabled = coerceBooleanProperty(value);
898
+ /** @type {?} */
899
+ var newValue = coerceBooleanProperty(value);
900
+ if (newValue !== this._disabled) {
901
+ this._disabled = newValue;
902
+ this._toggleNativeDragInteractions();
903
+ }
899
904
  },
900
905
  enumerable: true,
901
906
  configurable: true
@@ -1663,10 +1668,11 @@ DragRef = /** @class */ (function () {
1663
1668
  * @return {?}
1664
1669
  */
1665
1670
  function () {
1671
+ if (!this._rootElement || !this._handles) {
1672
+ return;
1673
+ }
1666
1674
  /** @type {?} */
1667
- var shouldEnable = this._handles.length > 0;
1668
- // We go through the trouble of keeping track of whether the interactions are enabled,
1669
- // because we want to avoid triggering style recalculations unless we really have to.
1675
+ var shouldEnable = this.disabled || this._handles.length > 0;
1670
1676
  if (shouldEnable !== this._nativeInteractionsEnabled) {
1671
1677
  this._nativeInteractionsEnabled = shouldEnable;
1672
1678
  toggleNativeDragInteractions(this._rootElement, shouldEnable);
@@ -1853,6 +1859,7 @@ var CdkDrag = /** @class */ (function () {
1853
1859
  */
1854
1860
  function (value) {
1855
1861
  this._disabled = coerceBooleanProperty(value);
1862
+ this._dragRef.disabled = this._disabled;
1856
1863
  },
1857
1864
  enumerable: true,
1858
1865
  configurable: true
@@ -1913,13 +1920,7 @@ var CdkDrag = /** @class */ (function () {
1913
1920
  this._rootElementInitSubscription = this._ngZone.onStable.asObservable()
1914
1921
  .pipe(take(1))
1915
1922
  .subscribe(function () {
1916
- /** @type {?} */
1917
- var rootElement = _this._getRootElement();
1918
- if (rootElement.nodeType !== _this._document.ELEMENT_NODE) {
1919
- throw Error("cdkDrag must be attached to an element node. " +
1920
- ("Currently attached to \"" + rootElement.nodeName + "\"."));
1921
- }
1922
- _this._dragRef.withRootElement(rootElement);
1923
+ _this._updateRootElement();
1923
1924
  _this._handles.changes
1924
1925
  .pipe(startWith(_this._handles))
1925
1926
  .subscribe(function (handleList) {
@@ -1927,6 +1928,23 @@ var CdkDrag = /** @class */ (function () {
1927
1928
  });
1928
1929
  });
1929
1930
  };
1931
+ /**
1932
+ * @param {?} changes
1933
+ * @return {?}
1934
+ */
1935
+ CdkDrag.prototype.ngOnChanges = /**
1936
+ * @param {?} changes
1937
+ * @return {?}
1938
+ */
1939
+ function (changes) {
1940
+ /** @type {?} */
1941
+ var rootSelectorChange = changes.rootElementSelector;
1942
+ // We don't have to react to the first change since it's being
1943
+ // handled in `ngAfterViewInit` where it needs to be deferred.
1944
+ if (rootSelectorChange && !rootSelectorChange.firstChange) {
1945
+ this._updateRootElement();
1946
+ }
1947
+ };
1930
1948
  /**
1931
1949
  * @return {?}
1932
1950
  */
@@ -1937,14 +1955,14 @@ var CdkDrag = /** @class */ (function () {
1937
1955
  this._rootElementInitSubscription.unsubscribe();
1938
1956
  this._dragRef.dispose();
1939
1957
  };
1940
- /** Gets the root draggable element, based on the `rootElementSelector`. */
1958
+ /** Syncs the root element with the `DragRef`. */
1941
1959
  /**
1942
- * Gets the root draggable element, based on the `rootElementSelector`.
1960
+ * Syncs the root element with the `DragRef`.
1943
1961
  * @private
1944
1962
  * @return {?}
1945
1963
  */
1946
- CdkDrag.prototype._getRootElement = /**
1947
- * Gets the root draggable element, based on the `rootElementSelector`.
1964
+ CdkDrag.prototype._updateRootElement = /**
1965
+ * Syncs the root element with the `DragRef`.
1948
1966
  * @private
1949
1967
  * @return {?}
1950
1968
  */
@@ -1953,8 +1971,12 @@ var CdkDrag = /** @class */ (function () {
1953
1971
  var element = this.element.nativeElement;
1954
1972
  /** @type {?} */
1955
1973
  var rootElement = this.rootElementSelector ?
1956
- getClosestMatchingAncestor(element, this.rootElementSelector) : null;
1957
- return rootElement || element;
1974
+ getClosestMatchingAncestor(element, this.rootElementSelector) : element;
1975
+ if (rootElement && rootElement.nodeType !== this._document.ELEMENT_NODE) {
1976
+ throw Error("cdkDrag must be attached to an element node. " +
1977
+ ("Currently attached to \"" + rootElement.nodeName + "\"."));
1978
+ }
1979
+ this._dragRef.withRootElement(rootElement || element);
1958
1980
  };
1959
1981
  /** Gets the boundary element, based on the `boundaryElementSelector`. */
1960
1982
  /**