@adobe/alloy 2.11.0-alpha.0 → 2.11.0-alpha.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.
@@ -21,18 +21,11 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
21
21
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
22
22
 
23
23
  // Trying to match ID or CSS class
24
- var CSS_IDENTIFIER_PATTERN = /(#|\.)(-?\w+)/g; // This is required to remove leading " > " from parsed pieces
25
-
26
- var SIBLING_PATTERN = /^\s*>?\s*/;
27
-
28
- var cleanUp = function cleanUp(str) {
29
- return str.replace(SIBLING_PATTERN, "").trim();
30
- }; // Here we use CSS.escape() to make sure we get
24
+ var CSS_IDENTIFIER_PATTERN = /(#|\.)(-?\w+)/g; // Here we use CSS.escape() to make sure we get
31
25
  // correct values for ID and CSS class
32
26
  // Please check: https://www.w3.org/TR/css-syntax-3/#escaping
33
27
  // CSS.escape() polyfill can be found here: https://github.com/mathiasbynens/CSS.escape
34
28
 
35
-
36
29
  var replaceIdentifier = function replaceIdentifier(_, $1, $2) {
37
30
  return "" + $1 + (0, _css.default)($2);
38
31
  };
@@ -51,7 +44,7 @@ var parseSelector = function parseSelector(rawSelector) {
51
44
  var i = 0;
52
45
 
53
46
  while (i < length) {
54
- var sel = cleanUp(parts[i]);
47
+ var sel = parts[i];
55
48
  var eq = parts[i + 1];
56
49
 
57
50
  if (eq) {
@@ -15,5 +15,5 @@ governing permissions and limitations under the License.
15
15
  */
16
16
  // The __VERSION__ keyword will be replace at alloy build time with the package.json version.
17
17
  // see babel-plugin-version
18
- var _default = "2.11.0-alpha.0";
18
+ var _default = "2.11.0-alpha.1";
19
19
  exports.default = _default;
@@ -15,8 +15,22 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
15
15
  OF ANY KIND, either express or implied. See the License for the specific language
16
16
  governing permissions and limitations under the License.
17
17
  */
18
+ var SIBLING_PATTERN = /^\s*>/;
19
+
18
20
  var _default = function _default(context, selector) {
19
- return (0, _toArray.default)(context.querySelectorAll(selector));
21
+ if (!SIBLING_PATTERN.test(selector)) {
22
+ return (0, _toArray.default)(context.querySelectorAll(selector));
23
+ }
24
+
25
+ var tag = "alloy-" + Date.now(); // We could use a :scope selector here, but we want to be IE compliant
26
+ // so we add a dummy css class to be able to select the children
27
+
28
+ try {
29
+ context.classList.add(tag);
30
+ return (0, _toArray.default)(context.querySelectorAll("." + tag + " " + selector));
31
+ } finally {
32
+ context.classList.remove(tag);
33
+ }
20
34
  };
21
35
 
22
36
  exports.default = _default;
@@ -13,16 +13,11 @@ import escape from "css.escape";
13
13
  import { selectNodes } from "../../../../utils/dom";
14
14
  import { isNotEqSelector, splitWithEq } from "./helperForEq"; // Trying to match ID or CSS class
15
15
 
16
- const CSS_IDENTIFIER_PATTERN = /(#|\.)(-?\w+)/g; // This is required to remove leading " > " from parsed pieces
17
-
18
- const SIBLING_PATTERN = /^\s*>?\s*/;
19
-
20
- const cleanUp = str => str.replace(SIBLING_PATTERN, "").trim(); // Here we use CSS.escape() to make sure we get
16
+ const CSS_IDENTIFIER_PATTERN = /(#|\.)(-?\w+)/g; // Here we use CSS.escape() to make sure we get
21
17
  // correct values for ID and CSS class
22
18
  // Please check: https://www.w3.org/TR/css-syntax-3/#escaping
23
19
  // CSS.escape() polyfill can be found here: https://github.com/mathiasbynens/CSS.escape
24
20
 
25
-
26
21
  const replaceIdentifier = (_, $1, $2) => `${$1}${escape($2)}`;
27
22
 
28
23
  export const escapeIdentifiersInSelector = selector => {
@@ -38,7 +33,7 @@ export const parseSelector = rawSelector => {
38
33
  let i = 0;
39
34
 
40
35
  while (i < length) {
41
- const sel = cleanUp(parts[i]);
36
+ const sel = parts[i];
42
37
  const eq = parts[i + 1];
43
38
 
44
39
  if (eq) {
@@ -11,4 +11,4 @@ governing permissions and limitations under the License.
11
11
  */
12
12
  // The __VERSION__ keyword will be replace at alloy build time with the package.json version.
13
13
  // see babel-plugin-version
14
- export default "2.11.0-alpha.0";
14
+ export default "2.11.0-alpha.1";
@@ -10,4 +10,19 @@ OF ANY KIND, either express or implied. See the License for the specific languag
10
10
  governing permissions and limitations under the License.
11
11
  */
12
12
  import toArray from "../toArray";
13
- export default ((context, selector) => toArray(context.querySelectorAll(selector)));
13
+ const SIBLING_PATTERN = /^\s*>/;
14
+ export default ((context, selector) => {
15
+ if (!SIBLING_PATTERN.test(selector)) {
16
+ return toArray(context.querySelectorAll(selector));
17
+ }
18
+
19
+ const tag = `alloy-${Date.now()}`; // We could use a :scope selector here, but we want to be IE compliant
20
+ // so we add a dummy css class to be able to select the children
21
+
22
+ try {
23
+ context.classList.add(tag);
24
+ return toArray(context.querySelectorAll(`.${tag} ${selector}`));
25
+ } finally {
26
+ context.classList.remove(tag);
27
+ }
28
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/alloy",
3
- "version": "2.11.0-alpha.0",
3
+ "version": "2.11.0-alpha.1",
4
4
  "description": "Adobe Experience Platform Web SDK",
5
5
  "main": "libEs5/index.js",
6
6
  "module": "libEs6/index.js",
@@ -64,7 +64,7 @@
64
64
  "uuid": "^3.3.2"
65
65
  },
66
66
  "devDependencies": {
67
- "@adobe/alloy": "^2.10.1",
67
+ "@adobe/alloy": "^2.11.0-alpha.0",
68
68
  "@babel/cli": "^7.12.8",
69
69
  "@babel/core": "^7.2.2",
70
70
  "@babel/plugin-proposal-object-rest-spread": "^7.3.2",