@builder.io/sdk
Advanced tools
Comparing version 0.0.97 to 0.0.98
@@ -20,3 +20,3 @@ export declare class EventCapturer { | ||
private findParent(target, callback, checkElement?); | ||
private getCssForElement(el); | ||
private getCssForElement(el, seekProperty?); | ||
private findPageBlockParent(target); | ||
@@ -23,0 +23,0 @@ private findBuilderParent(target); |
@@ -458,3 +458,4 @@ 'use strict'; | ||
}; | ||
EventCapturer.prototype.getCssForElement = function (el) { | ||
EventCapturer.prototype.getCssForElement = function (el, seekProperty) { | ||
if (seekProperty === void 0) { seekProperty = null; } | ||
var sheets = document.styleSheets; | ||
@@ -468,2 +469,5 @@ var ret = []; | ||
var rule = rules[ruleIndex]; | ||
if (seekProperty && !rule.style[seekProperty]) { | ||
continue; | ||
} | ||
if (rule.selectorText && el.matches(rule.selectorText)) { | ||
@@ -481,4 +485,5 @@ ret.push(rule); | ||
var rect = el.getBoundingClientRect(); | ||
// CHeck if parent has fixed height | ||
var rules = _this.getCssForElement(el); | ||
// Check if parent has fixed height | ||
// FIXME: too slow - element.matches is expensive to run over and over | ||
var rules = _this.getCssForElement(el, 'height'); | ||
for (var _i = 0, rules_1 = rules; _i < rules_1.length; _i++) { | ||
@@ -497,3 +502,3 @@ var rule = rules_1[_i]; | ||
// (i.e. get topmost parent that shares the same bottom point) | ||
!_this.findParent(el, function (parent) { return Math.abs(parent.getBoundingClientRect().bottom - rect.bottom) < 10; })); | ||
!_this.findParent(el, function (parent) { return Math.abs(parent.getBoundingClientRect().bottom - rect.bottom) < 10; }, false)); | ||
}); | ||
@@ -500,0 +505,0 @@ }; |
@@ -452,3 +452,4 @@ import uniqueSelector from 'unique-selector'; | ||
}; | ||
EventCapturer.prototype.getCssForElement = function (el) { | ||
EventCapturer.prototype.getCssForElement = function (el, seekProperty) { | ||
if (seekProperty === void 0) { seekProperty = null; } | ||
var sheets = document.styleSheets; | ||
@@ -462,2 +463,5 @@ var ret = []; | ||
var rule = rules[ruleIndex]; | ||
if (seekProperty && !rule.style[seekProperty]) { | ||
continue; | ||
} | ||
if (rule.selectorText && el.matches(rule.selectorText)) { | ||
@@ -475,4 +479,5 @@ ret.push(rule); | ||
var rect = el.getBoundingClientRect(); | ||
// CHeck if parent has fixed height | ||
var rules = _this.getCssForElement(el); | ||
// Check if parent has fixed height | ||
// FIXME: too slow - element.matches is expensive to run over and over | ||
var rules = _this.getCssForElement(el, 'height'); | ||
for (var _i = 0, rules_1 = rules; _i < rules_1.length; _i++) { | ||
@@ -491,3 +496,3 @@ var rule = rules_1[_i]; | ||
// (i.e. get topmost parent that shares the same bottom point) | ||
!_this.findParent(el, function (parent) { return Math.abs(parent.getBoundingClientRect().bottom - rect.bottom) < 10; })); | ||
!_this.findParent(el, function (parent) { return Math.abs(parent.getBoundingClientRect().bottom - rect.bottom) < 10; }, false)); | ||
}); | ||
@@ -494,0 +499,0 @@ }; |
{ | ||
"name": "@builder.io/sdk", | ||
"version": "0.0.97", | ||
"version": "0.0.98", | ||
"browser": "./dist/index.umd.min.js", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.cjs.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1040646
15930