ember-primitives 0.45.0 → 0.45.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heading.d.ts","sourceRoot":"","sources":["../../src/components/heading.gts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"heading.d.ts","sourceRoot":"","sources":["../../src/components/heading.gts"],"names":[],"mappings":"AAkLA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAK3C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAuItC,qBAAa,OAAQ,SAAQ,SAAS,CAAC;IACrC,OAAO,EAAE,WAAW,CAAC;IACrB,MAAM,EAAE;QAAE,OAAO,EAAE,EAAE,CAAA;KAAE,CAAC;CACzB,CAAC;IACA,kBAAkB,EAAE,IAAI,CAAC;gBACb,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM;IAMtC,IAAI,KAAK,WAWR;IAED,IAAI,MAAM,WAET;CAqBF"}
|
|
@@ -15,6 +15,17 @@ const TEST_BOUNDARY = "ember-testing";
|
|
|
15
15
|
function isRoot(element) {
|
|
16
16
|
return element === document.body || element.id === TEST_BOUNDARY;
|
|
17
17
|
}
|
|
18
|
+
function findHeadingIn(node) {
|
|
19
|
+
if (!(node instanceof Element)) return;
|
|
20
|
+
if (SECTION_HEADINGS.has(node.tagName)) {
|
|
21
|
+
const level = parseInt(node.tagName.replace("h", "").replace("H", ""));
|
|
22
|
+
return level;
|
|
23
|
+
}
|
|
24
|
+
for (const child of node.children) {
|
|
25
|
+
const level = findHeadingIn(child);
|
|
26
|
+
if (level) return level;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
18
29
|
/**
|
|
19
30
|
* The Platform native 'closest' function can't punch through shadow-boundaries
|
|
20
31
|
*/
|
|
@@ -65,9 +76,8 @@ function levelOf(node) {
|
|
|
65
76
|
assert(`[BUG]: Could not find a stopping boundary for automatic heading level detection. Checked for ${[...BOUNDARY_ELEMENTS, "body", "#ember-testing"].map(x => x.toLowerCase()).join(", ")}`, stopAt);
|
|
66
77
|
let current = ourBoundary.parentNode;
|
|
67
78
|
while (current) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const level = parseInt(child.tagName.replace("h", "").replace("H", ""));
|
|
79
|
+
const level = findHeadingIn(current);
|
|
80
|
+
if (level) {
|
|
71
81
|
return level + 1;
|
|
72
82
|
}
|
|
73
83
|
if (current === stopAt) break;
|