@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
@@ -1 +1 @@
1
- {"version":3,"file":"cdk.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,MAAa,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB,CAAC;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"cdk.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,MAAa,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
@@ -77,6 +79,21 @@ function coerceCssPixelValue(value) {
77
79
  return typeof value === 'string' ? value : `${value}px`;
78
80
  }
79
81
 
82
+ /**
83
+ * @fileoverview added by tsickle
84
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
85
+ */
86
+ /**
87
+ * Coerces an ElementRef or an Element into an element.
88
+ * Useful for APIs that can accept either a ref or the native element itself.
89
+ * @template T
90
+ * @param {?} elementOrRef
91
+ * @return {?}
92
+ */
93
+ function coerceElement(elementOrRef) {
94
+ return elementOrRef instanceof ElementRef ? elementOrRef.nativeElement : elementOrRef;
95
+ }
96
+
80
97
  /**
81
98
  * @fileoverview added by tsickle
82
99
  * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -87,5 +104,5 @@ function coerceCssPixelValue(value) {
87
104
  * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
88
105
  */
89
106
 
90
- export { coerceBooleanProperty, coerceNumberProperty, _isNumberValue, coerceArray, coerceCssPixelValue };
107
+ export { coerceBooleanProperty, coerceNumberProperty, _isNumberValue, coerceArray, coerceCssPixelValue, coerceElement };
91
108
  //# sourceMappingURL=coercion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"coercion.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,CAA1B,EAA6B,KAAK,CAAlC,CAAoC,KAAK,OAAO,CAAC;CAChD;;;;;;;;;;;;ADAD,AAAA,SAAgB,oBAAoB,CAAC,KAAU,EAAE,aAAa,GAAG,CAAC,EAAlE;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,GAAG,CAA7C,EAAgD,KAAK,CAArD,EAAA,CAAyD,CAAC;CACzD;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"coercion.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,CAA1B,EAA6B,KAAK,CAAlC,CAAoC,KAAK,OAAO,CAAC;CAChD;;;;;;;;;;;;ADAD,AAAA,SAAgB,oBAAoB,CAAC,KAAU,EAAE,aAAa,GAAG,CAAC,EAAlE;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,GAAG,CAA7C,EAAgD,KAAK,CAArD,EAAA,CAAyD,CAAC;CACzD;;;;;;;;;;;;;ADDD,AAAA,SAAgB,aAAa,CAAI,YAA+B,EAAhE;IACE,OAAO,YAAY,YAAY,UAAU,GAAG,YAAY,CAAC,aAAa,GAAG,YAAY,CAAC;CACvF;;;;;;;;;;;;;;"}
@@ -638,13 +638,13 @@ class DragRef {
638
638
  */
639
639
  this._boundaryElement = null;
640
640
  /**
641
- * Elements that can be used to drag the draggable item.
641
+ * Whether the native dragging interactions have been enabled on the root element.
642
642
  */
643
- this._handles = [];
643
+ this._nativeInteractionsEnabled = true;
644
644
  /**
645
- * Whether the native interactions on the element are enabled.
645
+ * Elements that can be used to drag the draggable item.
646
646
  */
647
- this._nativeInteractionsEnabled = true;
647
+ this._handles = [];
648
648
  this._disabled = false;
649
649
  /**
650
650
  * Emits as the drag sequence is being prepared.
@@ -830,7 +830,12 @@ class DragRef {
830
830
  * @return {?}
831
831
  */
832
832
  set disabled(value) {
833
- this._disabled = coerceBooleanProperty(value);
833
+ /** @type {?} */
834
+ const newValue = coerceBooleanProperty(value);
835
+ if (newValue !== this._disabled) {
836
+ this._disabled = newValue;
837
+ this._toggleNativeDragInteractions();
838
+ }
834
839
  }
835
840
  /**
836
841
  * Returns the element that is being used as a placeholder
@@ -1393,10 +1398,11 @@ class DragRef {
1393
1398
  * @return {?}
1394
1399
  */
1395
1400
  _toggleNativeDragInteractions() {
1401
+ if (!this._rootElement || !this._handles) {
1402
+ return;
1403
+ }
1396
1404
  /** @type {?} */
1397
- const shouldEnable = this._handles.length > 0;
1398
- // We go through the trouble of keeping track of whether the interactions are enabled,
1399
- // because we want to avoid triggering style recalculations unless we really have to.
1405
+ const shouldEnable = this.disabled || this._handles.length > 0;
1400
1406
  if (shouldEnable !== this._nativeInteractionsEnabled) {
1401
1407
  this._nativeInteractionsEnabled = shouldEnable;
1402
1408
  toggleNativeDragInteractions(this._rootElement, shouldEnable);
@@ -1583,6 +1589,7 @@ class CdkDrag {
1583
1589
  */
1584
1590
  set disabled(value) {
1585
1591
  this._disabled = coerceBooleanProperty(value);
1592
+ this._dragRef.disabled = this._disabled;
1586
1593
  }
1587
1594
  /**
1588
1595
  * Returns the element that is being used as a placeholder
@@ -1617,13 +1624,7 @@ class CdkDrag {
1617
1624
  this._rootElementInitSubscription = this._ngZone.onStable.asObservable()
1618
1625
  .pipe(take(1))
1619
1626
  .subscribe(() => {
1620
- /** @type {?} */
1621
- const rootElement = this._getRootElement();
1622
- if (rootElement.nodeType !== this._document.ELEMENT_NODE) {
1623
- throw Error(`cdkDrag must be attached to an element node. ` +
1624
- `Currently attached to "${rootElement.nodeName}".`);
1625
- }
1626
- this._dragRef.withRootElement(rootElement);
1627
+ this._updateRootElement();
1627
1628
  this._handles.changes
1628
1629
  .pipe(startWith(this._handles))
1629
1630
  .subscribe((handleList) => {
@@ -1631,6 +1632,19 @@ class CdkDrag {
1631
1632
  });
1632
1633
  });
1633
1634
  }
1635
+ /**
1636
+ * @param {?} changes
1637
+ * @return {?}
1638
+ */
1639
+ ngOnChanges(changes) {
1640
+ /** @type {?} */
1641
+ const rootSelectorChange = changes.rootElementSelector;
1642
+ // We don't have to react to the first change since it's being
1643
+ // handled in `ngAfterViewInit` where it needs to be deferred.
1644
+ if (rootSelectorChange && !rootSelectorChange.firstChange) {
1645
+ this._updateRootElement();
1646
+ }
1647
+ }
1634
1648
  /**
1635
1649
  * @return {?}
1636
1650
  */
@@ -1639,17 +1653,21 @@ class CdkDrag {
1639
1653
  this._dragRef.dispose();
1640
1654
  }
1641
1655
  /**
1642
- * Gets the root draggable element, based on the `rootElementSelector`.
1656
+ * Syncs the root element with the `DragRef`.
1643
1657
  * @private
1644
1658
  * @return {?}
1645
1659
  */
1646
- _getRootElement() {
1660
+ _updateRootElement() {
1647
1661
  /** @type {?} */
1648
1662
  const element = this.element.nativeElement;
1649
1663
  /** @type {?} */
1650
1664
  const rootElement = this.rootElementSelector ?
1651
- getClosestMatchingAncestor(element, this.rootElementSelector) : null;
1652
- return rootElement || element;
1665
+ getClosestMatchingAncestor(element, this.rootElementSelector) : element;
1666
+ if (rootElement && rootElement.nodeType !== this._document.ELEMENT_NODE) {
1667
+ throw Error(`cdkDrag must be attached to an element node. ` +
1668
+ `Currently attached to "${rootElement.nodeName}".`);
1669
+ }
1670
+ this._dragRef.withRootElement(rootElement || element);
1653
1671
  }
1654
1672
  /**
1655
1673
  * Gets the boundary element, based on the `boundaryElementSelector`.