90 return adoptRef(*new IntersectionObserver(WTFMove(callback), WTFMove(init), rootMarginOrException.releaseReturnValue()));
90 Vector<double> thresholds;
91 if (WTF::holds_alternative<double>(init.threshold))
92 thresholds.append(WTF::get<double>(init.threshold));
93 else
94 thresholds = WTF::get<Vector<double>>(WTFMove(init.threshold));
95
96 for (auto threshold : thresholds) {
97 if (threshold < 0 || threshold > 1)
98 return Exception { RangeError, "Failed to construct 'IntersectionObserver': all thresholds must lie in the range [0.0, 1.0]." };
99 }
100
101 return adoptRef(*new IntersectionObserver(WTFMove(callback), WTFMove(init.root), rootMarginOrException.releaseReturnValue(), WTFMove(thresholds)));