diff --git a/CHANGELOG.md b/CHANGELOG.md index af0f8de..6f0a282 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +# 1.2.3 + +Released on Sunday, November 22 2026. + +- Fixed `undefined` for an argument of an enumeration (e.g. the `how` of `compareBoundaryPoints`) throwing an error scripts could not catch +- Fixed event handler attributes of forms and selects (e.g. `form.onsubmit`) not being set +- Fixed a frame not finding the functions and variables of a script of another window, e.g. `parent.notify()` +- Fixed `adoptedStyleSheets` not being an array +- Added the constants of the interfaces, e.g. `Node.ELEMENT_NODE`, `Range.START_TO_END` or `NodeFilter.SHOW_ELEMENT` +- Added the callbacks of form-associated custom elements, e.g. `formResetCallback` + # 1.2.2 Released on Sunday, November 15 2026. diff --git a/src/AngleSharp.Js.Docs/package.json b/src/AngleSharp.Js.Docs/package.json index 5d49256..23c6a67 100644 --- a/src/AngleSharp.Js.Docs/package.json +++ b/src/AngleSharp.Js.Docs/package.json @@ -1,6 +1,6 @@ { "name": "@anglesharp/js", - "version": "1.2.2", + "version": "1.2.3", "preview": true, "description": "The doclet for the AngleSharp.Js documentation.", "keywords": [ diff --git a/src/AngleSharp.Js.Tests/Acid3Tests.cs b/src/AngleSharp.Js.Tests/Acid3Tests.cs new file mode 100644 index 0000000..70919cd --- /dev/null +++ b/src/AngleSharp.Js.Tests/Acid3Tests.cs @@ -0,0 +1,62 @@ +namespace AngleSharp.Js.Tests +{ + using AngleSharp.Dom; + using AngleSharp.Html.Dom; + using NUnit.Framework; + using System.Threading.Tasks; + + /// + /// Behavior the Acid3 test (acid3.acidtests.org) relies on. + /// + [TestFixture] + public class Acid3Tests + { + [Test] + public async Task ConstantsAreOnTheInterfacesAndTheirInstances() + { + var result = await "[Node.ELEMENT_NODE, document.DOCUMENT_FRAGMENT_NODE, document.documentElement.TEXT_NODE, Range.START_TO_END, document.createRange().END_TO_START, Event.CAPTURING_PHASE, NodeFilter.SHOW_ELEMENT].join()".EvalScriptAsync(); + Assert.AreEqual("1,11,3,1,3,1,1", result); + } + + [Test] + public async Task ConstantsCannotBeChanged() + { + var result = await "(function () { Node.ELEMENT_NODE = 5; document.ELEMENT_NODE = 6; return [Node.ELEMENT_NODE, document.ELEMENT_NODE].join(); })()".EvalScriptAsync(); + Assert.AreEqual("1,1", result); + } + + [Test] + public async Task UndefinedForAnEnumerationArgumentIsZero() + { + var result = await "(function () { var r = document.createRange(); return r.compareBoundaryPoints(r.NO_SUCH_CONSTANT, r.cloneRange()); })()".EvalScriptAsync(); + Assert.AreEqual("0", result); + } + + [Test] + public async Task EventHandlerOfAFormIsNotANamedProperty() + { + var result = await "(function () { var f = document.createElement('form'); var n = 0; f.onsubmit = function () { n++; }; f.appendChild(document.createElement('input')); document.documentElement.appendChild(f); f.dispatchEvent(new Event('submit')); return [n, typeof f.onsubmit, f.length, f[0].tagName].join(); })()".EvalScriptAsync(); + Assert.AreEqual("1,function,1,INPUT", result); + } + + [Test] + public async Task FrameCallsAFunctionOfItsParent() + { + var config = Configuration.Default.WithJs().WithEventLoop(); + var document = await BrowsingContext.New(config).OpenAsync(m => m.Content(@"")); + await document.WhenStable(); + var frame = (IHtmlInlineFrameElement)document.QuerySelector("iframe"); + await frame.ContentDocument.WhenStable(); + + Assert.AreEqual("function from frame", document.Title); + } + } +} diff --git a/src/AngleSharp.Js.Tests/ObservableArrayTests.cs b/src/AngleSharp.Js.Tests/ObservableArrayTests.cs new file mode 100644 index 0000000..ce14f00 --- /dev/null +++ b/src/AngleSharp.Js.Tests/ObservableArrayTests.cs @@ -0,0 +1,61 @@ +namespace AngleSharp.Js.Tests +{ + using AngleSharp.Attributes; + using AngleSharp.Dom; + using NUnit.Framework; + using System; + using System.Collections.Generic; + using System.Runtime.CompilerServices; + using System.Threading.Tasks; + + [DomExposed("Document")] + public static class ProbeObservableArrayExtensions + { + private static readonly ConditionalWeakTable> Lists = new ConditionalWeakTable>(); + + public static List Of(IDocument document) => Lists.GetValue(document, _ => new List()); + + [DomName("probeElements")] + [DomAccessor(Accessors.Getter)] + public static IList GetProbeElements(this IDocument document) => Of(document); + + [DomName("probeElements")] + [DomAccessor(Accessors.Setter)] + public static void SetProbeElements(this IDocument document, IEnumerable elements) + { + var list = Of(document); + list.Clear(); + list.AddRange(elements); + } + } + + /// + /// A mutable IList of the DOM is a WebIDL ObservableArray (e.g. adoptedStyleSheets): an + /// array for scripts, whose changes go to the list. + /// + [TestFixture] + public class ObservableArrayTests + { + [TestCase("Array.isArray(document.probeElements)", "True")] + [TestCase("document.probeElements === document.probeElements", "True")] + [TestCase("document.probeElements = document.probeElements.concat([document.body]); document.probeElements[0] === document.body", "True")] + [TestCase("document.probeElements.push(document.body, document.head); document.probeElements.pop(); document.probeElements.length", "1")] + [TestCase("try { document.probeElements.push(1); 'none' } catch (e) { e.name }", "TypeError")] + public async Task MutableListIsAnArray(String script, String expected) + { + var document = await BrowsingContext.New(Configuration.Default.WithJs().With(new ProbeService())).OpenAsync(m => m.Content("")); + + Assert.AreEqual(expected, document.ExecuteScript(script)?.ToString()); + } + + [Test] + public async Task ChangesOfTheArrayGoToTheList() + { + var document = await BrowsingContext.New(Configuration.Default.WithJs().With(new ProbeService())).OpenAsync(m => m.Content("")); + + document.ExecuteScript("document.probeElements.push(document.body)"); + + Assert.AreEqual(new[] { document.Body }, ProbeObservableArrayExtensions.Of(document)); + } + } +} diff --git a/src/AngleSharp.Js/Cache/ConstantCache.cs b/src/AngleSharp.Js/Cache/ConstantCache.cs new file mode 100644 index 0000000..1532e45 --- /dev/null +++ b/src/AngleSharp.Js/Cache/ConstantCache.cs @@ -0,0 +1,98 @@ +namespace AngleSharp.Js.Cache +{ + using AngleSharp.Attributes; + using System; + using System.Collections.Concurrent; + using System.Collections.Generic; + using System.Linq; + using System.Reflection; + + /// + /// The WebIDL constants of the interfaces (e.g. Node.ELEMENT_NODE), which the libraries + /// declare as the fields of an enum named like the interface owning them. + /// + static class ConstantCache + { + private static readonly ConcurrentDictionary[]>> _constants = new(); + + // Enums whose name doesn't say the interface owning their constants (AngleSharp 1.10 names + // the document for those of a node, which all nodes have). + private static readonly Dictionary _owners = new(StringComparer.Ordinal) + { + { "AngleSharp.Dom.NodeType", "Node" }, + { "AngleSharp.Dom.DocumentPositions", "Node" }, + { "AngleSharp.Dom.DomError", "DOMException" }, + }; + + public static IEnumerable> GetConstants(this IEnumerable libs, String name) + { + if (name is null) + { + return []; + } + + return libs + .Select(m => _constants.GetOrAdd(m, Collect)) + .SelectMany(m => m.TryGetValue(name, out var constants) ? constants : []); + } + + private static IReadOnlyDictionary[]> Collect(Assembly assembly) + { + var result = new Dictionary>>(StringComparer.Ordinal); + + foreach (var type in GetTypes(assembly)) + { + var info = type.GetTypeInfo(); + + if (!info.IsEnum || info.GetCustomAttribute() != null) + { + continue; + } + + var owner = _owners.TryGetValue(type.FullName ?? String.Empty, out var known) ? known : + info.GetCustomAttributes().FirstOrDefault()?.OfficialName; + + if (owner is null) + { + continue; + } + + foreach (var field in info.DeclaredFields.Where(m => m.IsLiteral)) + { + var constant = field.GetCustomAttributes().FirstOrDefault()?.OfficialName; + + if (constant is not null && IsConstantName(constant)) + { + if (!result.TryGetValue(owner, out var list)) + { + result[owner] = list = []; + } + + if (!list.Any(m => m.Key == constant)) + { + list.Add(new KeyValuePair(constant, Convert.ToDouble(field.GetRawConstantValue()))); + } + } + } + } + + return result.ToDictionary(m => m.Key, m => m.Value.ToArray(), StringComparer.Ordinal); + } + + // constants are all upper case (the members of a string enumeration are not) + private static Boolean IsConstantName(String name) => + name.Length > 0 && Char.IsUpper(name[0]) && name.All(c => Char.IsUpper(c) || Char.IsDigit(c) || c == '_'); + + private static IEnumerable GetTypes(Assembly assembly) + { + try + { + return assembly.ExportedTypes; + } + catch (Exception) + { + return []; + } + } + } +} diff --git a/src/AngleSharp.Js/Cache/DomShapeCache.cs b/src/AngleSharp.Js/Cache/DomShapeCache.cs index 27d9604..9371e99 100644 --- a/src/AngleSharp.Js/Cache/DomShapeCache.cs +++ b/src/AngleSharp.Js/Cache/DomShapeCache.cs @@ -182,6 +182,15 @@ public DomShape Build(Engine engine) } } + // The constants are on the prototype as well, so that a node knows them (node.ELEMENT_NODE). + foreach (var constant in _libs.Assemblies.GetConstants(_name)) + { + if (!_members.ContainsKey(constant.Key) && !String.Equals(constant.Key, ConstructorName, StringComparison.Ordinal)) + { + builder.Constant(constant.Key, JsNumber.Create(constant.Value), true); + } + } + if (constructor != null) { // The attributes an eagerly written constructor had, and still resolved on first diff --git a/src/AngleSharp.Js/Cache/MethodCache.cs b/src/AngleSharp.Js/Cache/MethodCache.cs index c364be2..8c05dfe 100644 --- a/src/AngleSharp.Js/Cache/MethodCache.cs +++ b/src/AngleSharp.Js/Cache/MethodCache.cs @@ -32,6 +32,7 @@ private MethodDescription(MethodBase method) ReturnType = method.GetCustomAttribute()?.ReturnType; TakesWindow = parameters.Length > 0 && parameters[0].ParameterType == typeof(IWindow); GivenConversion = (method as MethodInfo)?.ReturnType.GetGivenConversion(); + ObservableElementType = ObservableArrays.GetElementType((method as MethodInfo)?.ReturnType); HasReceiver = TakesWindow || (method.IsStatic && method.IsDefined(typeof(ExtensionAttribute), false)); TakesParamArray = parameters.Length > 0 && parameters[parameters.Length - 1].GetCustomAttribute() != null; @@ -52,6 +53,11 @@ public static MethodDescription Of(MethodBase method) => public Type ReturnType { get; } + /// + /// Gets the type of the items if the method returns a WebIDL ObservableArray, else null. + /// + public Type ObservableElementType { get; } + public Boolean TakesWindow { get; } /// diff --git a/src/AngleSharp.Js/Dom/CustomElementHost.cs b/src/AngleSharp.Js/Dom/CustomElementHost.cs index 472d4a9..3caca6b 100644 --- a/src/AngleSharp.Js/Dom/CustomElementHost.cs +++ b/src/AngleSharp.Js/Dom/CustomElementHost.cs @@ -36,7 +36,7 @@ public static JsValue Get(this CustomElementRegistry registry, String name) => /// sealed class CustomElementHost : ICustomElementHost { - private static readonly String[] CallbackNames = { "connectedCallback", "disconnectedCallback", "adoptedCallback", "attributeChangedCallback" }; + private static readonly String[] CallbackNames = { "connectedCallback", "disconnectedCallback", "adoptedCallback", "attributeChangedCallback", "formAssociatedCallback", "formResetCallback", "formDisabledCallback", "formStateRestoreCallback" }; private readonly JsScriptingService _service; diff --git a/src/AngleSharp.Js/Dom/ObservableArrays.cs b/src/AngleSharp.Js/Dom/ObservableArrays.cs new file mode 100644 index 0000000..db1bca8 --- /dev/null +++ b/src/AngleSharp.Js/Dom/ObservableArrays.cs @@ -0,0 +1,131 @@ +namespace AngleSharp.Js +{ + using Jint; + using Jint.Native; + using Jint.Native.Function; + using Jint.Runtime.Interop; + using Jint.Runtime; + using System; + using System.Collections; + using System.Collections.Generic; + using System.Reflection; + using System.Runtime.CompilerServices; + + /// + /// WebIDL's ObservableArray (e.g. adoptedStyleSheets), a mutable IList<T> in the + /// DOM: script sees a real array (concat, spread, push, ...), whose changes go to the list. + /// The array is the same object each time; it shows what the list has when it is got. + /// + sealed class ObservableArrays + { + private const String ProxyFactory = @"(function (target, sync) { + return new Proxy(target, { + set: function (t, key, value) { t[key] = value; sync(t); return true; }, + deleteProperty: function (t, key) { delete t[key]; sync(t); return true; } + }); + })"; + + private readonly EngineInstance _engine; + private readonly ConditionalWeakTable _arrays = new ConditionalWeakTable(); + private JsValue _factory; + + public ObservableArrays(EngineInstance engine) + { + _engine = engine; + } + + /// + /// Gets the element type if the declared type stands for an ObservableArray, else null. + /// + public static Type GetElementType(Type type) => + type != null && type.GetTypeInfo().IsGenericType && type.GetGenericTypeDefinition() == typeof(IList<>) + ? type.GetGenericArguments()[0] + : null; + + public JsValue Get(Object list, Type elementType) + { + var entry = _arrays.GetValue(list, key => Create(key, elementType)); + var items = (IEnumerable)list; + var values = new List(); + + foreach (var item in items) + { + values.Add(item.ToJsValue(_engine)); + } + + entry.Syncing = true; + + try + { + entry.Target.Set("length", 0); + + for (var i = 0; i < values.Count; i++) + { + entry.Target.Set(i, values[i]); + } + } + finally + { + entry.Syncing = false; + } + + return entry.Proxy; + } + + private Entry Create(Object list, Type elementType) + { + var jint = _engine.Jint; + _factory ??= jint.Evaluate(ProxyFactory); + var entry = new Entry { Target = new JsArray(jint) }; + var listType = typeof(ICollection<>).MakeGenericType(elementType); + var clear = listType.GetMethod("Clear"); + var add = listType.GetMethod("Add"); + var sync = new ClrFunction(jint, "sync", (thisObject, arguments) => + { + if (!entry.Syncing) + { + var length = (Int32)TypeConverter.ToNumber(entry.Target.Get("length")); + var items = new List(length); + + for (var i = 0; i < length; i++) + { + var value = entry.Target.Get(i); + + // a hole is what an array method leaves on its way (pop deletes, then shortens) + if (value.IsUndefined()) + { + continue; + } + + var item = value.FromJsValue(); + + if (item == null || !elementType.IsInstanceOfType(item)) + { + throw new JavaScriptException(jint.Intrinsics.TypeError, "The value is not of the expected type."); + } + + items.Add(item); + } + + clear.Invoke(list, null); + + foreach (var item in items) + { + add.Invoke(list, new[] { item }); + } + } + + return JsValue.Undefined; + }); + entry.Proxy = jint.Invoke(_factory, entry.Target, sync); + return entry; + } + + private sealed class Entry + { + public JsArray Target; + public JsValue Proxy; + public Boolean Syncing; + } + } +} diff --git a/src/AngleSharp.Js/EngineInstance.cs b/src/AngleSharp.Js/EngineInstance.cs index fd42850..b537fe6 100644 --- a/src/AngleSharp.Js/EngineInstance.cs +++ b/src/AngleSharp.Js/EngineInstance.cs @@ -65,11 +65,12 @@ sealed class EngineInstance private readonly JsImportMap _importMap; private readonly ConditionalWeakTable _domExceptions = new ConditionalWeakTable(); private readonly Stack _customElementConstructions = new Stack(); + private readonly List> _unhandledRejections = new List>(); + private ObservableArrays _observableArrays; private JsValue _domException; private JsValue _lastReportedError; private Int32 _inlineModules; private JsValue _currentEvent = JsValue.Undefined; - private readonly List> _unhandledRejections = new List>(); #endregion @@ -608,6 +609,12 @@ public JsValue ToScriptValue(Exception error) : _engine.Intrinsics.Error.Construct(error?.Message ?? String.Empty); } + /// + /// Gets the array of a script for a mutable list of the DOM (a WebIDL ObservableArray). + /// + public JsValue GetObservableArray(Object list, Type elementType) => + (_observableArrays ??= new ObservableArrays(this)).Get(list, elementType); + /// /// Gets the DOMException of a script for the exception, which is the same object each time. /// @@ -859,7 +866,9 @@ private ObjectInstance CreateInstance(Object obj) private ObjectInstance CreateInstance(Object obj, Type type) { - var collection = type.GetIndexedCollection(); + // A node indexed like a collection (a form, a select) is a node still: only the node's + // proxy holds its event handler attributes (form.onsubmit), and it asks the indexers too. + var collection = obj is INode ? null : type.GetIndexedCollection(); if (collection != null) { diff --git a/src/AngleSharp.Js/Extensions/EngineExtensions.cs b/src/AngleSharp.Js/Extensions/EngineExtensions.cs index 18ec69f..0faacb2 100644 --- a/src/AngleSharp.Js/Extensions/EngineExtensions.cs +++ b/src/AngleSharp.Js/Extensions/EngineExtensions.cs @@ -12,6 +12,7 @@ namespace AngleSharp.Js using Jint.Runtime.Descriptors; using Jint.Runtime.Interop; using System; + using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Reflection; @@ -146,6 +147,15 @@ public static JsValue ToJsValue(this Object obj, EngineInstance engine, Type typ return obj.ToJsValue(engine); } + /// + /// Converts what a DOM member returned, which a mutable list of the DOM (a WebIDL + /// ObservableArray) is an array for. + /// + public static JsValue ToJsValue(this Object obj, EngineInstance engine, MethodDescription description) => + description.ObservableElementType is Type elementType && obj is IEnumerable && !engine.IsOutOfReach(obj) + ? engine.GetObservableArray(obj, elementType) + : obj.ToJsValue(engine, description.ReturnType); + public static ClrFunction AsValue(this Engine engine, string name, Func func) => new ClrFunction(engine, name, func); @@ -585,7 +595,7 @@ public static JsValue CallStatic(this EngineInstance instance, MethodInfo method { var parameters = instance.BuildArgs(method, arguments); var description = MethodDescription.Of(method); - return description.ToGiven(method.Invoke(null, parameters)).ToJsValue(instance, description.ReturnType); + return description.ToGiven(method.Invoke(null, parameters)).ToJsValue(instance, description); } catch (TargetInvocationException ex) { @@ -637,7 +647,7 @@ public static JsValue Call(this EngineInstance instance, MethodInfo method, JsVa Array.Copy(arguments, 0, newArgs, 1, arguments.Length); var parameters = instance.BuildArgs(method, newArgs); var inserted = InsertedScripts.FindUnstarted(null, parameters); - var result = description.ToGiven(method.Invoke(null, parameters)).ToJsValue(instance, description.ReturnType); + var result = description.ToGiven(method.Invoke(null, parameters)).ToJsValue(instance, description); RunInsertedScripts(instance, inserted); return result; } @@ -647,7 +657,7 @@ public static JsValue Call(this EngineInstance instance, MethodInfo method, JsVa var bound = BindToTarget(method, target); var parameters = instance.BuildArgs(bound, arguments); var inserted = InsertedScripts.FindUnstarted(target, parameters); - var result = description.ToGiven(bound.Invoke(target, parameters)).ToJsValue(instance, description.ReturnType); + var result = description.ToGiven(bound.Invoke(target, parameters)).ToJsValue(instance, description); RunInsertedScripts(instance, inserted); return result; } diff --git a/src/AngleSharp.Js/Extensions/JsValueExtensions.cs b/src/AngleSharp.Js/Extensions/JsValueExtensions.cs index 870d029..34054cf 100644 --- a/src/AngleSharp.Js/Extensions/JsValueExtensions.cs +++ b/src/AngleSharp.Js/Extensions/JsValueExtensions.cs @@ -373,8 +373,13 @@ public static Object As(this JsValue value, Type targetType, EngineInstance engi } } + // a WebIDL integer (e.g. the "how" of compareBoundaryPoints): undefined or NaN is 0 var underlyingType = Enum.GetUnderlyingType(targetType); - var raw = Convert.ChangeType(TypeConverter.ToNumber(value), underlyingType); + var integer = TypeConverter.ToNumber(value); + var raw = underlyingType == typeof(Int32) ? TypeConverter.ToInt32(value) : + underlyingType == typeof(UInt32) ? TypeConverter.ToUint32(value) : + underlyingType == typeof(UInt16) ? TypeConverter.ToUint16(value) : + Convert.ChangeType(ToNumeric(integer, Type.GetTypeCode(underlyingType)), underlyingType); return Enum.ToObject(targetType, raw); } else if (Nullable.GetUnderlyingType(targetType) is Type nullableType) diff --git a/src/AngleSharp.Js/JsScriptingService.cs b/src/AngleSharp.Js/JsScriptingService.cs index aa486f0..90dac27 100644 --- a/src/AngleSharp.Js/JsScriptingService.cs +++ b/src/AngleSharp.Js/JsScriptingService.cs @@ -213,6 +213,14 @@ public Object EvaluateScript(IDocument document, String source, String type, Str #region Helpers + /// + /// Gets the engine of the given window, if its document ran scripts already. + /// + internal static EngineInstance TryGetInstance(IWindow window) => + window?.Document?.Context?.GetService() is { } service && service._contexts.TryGetValue(window, out var instance) + ? instance + : null; + internal EngineInstance GetOrCreateInstance(IDocument document) { var objectContext = document.DefaultView; diff --git a/src/AngleSharp.Js/Proxies/DomConstructorInstance.cs b/src/AngleSharp.Js/Proxies/DomConstructorInstance.cs index 84152aa..3b5201b 100644 --- a/src/AngleSharp.Js/Proxies/DomConstructorInstance.cs +++ b/src/AngleSharp.Js/Proxies/DomConstructorInstance.cs @@ -10,6 +10,7 @@ namespace AngleSharp.Js using Jint.Runtime.Descriptors; using Jint.Runtime.Interop; using System; + using System.Collections.Generic; using System.Reflection; sealed class DomConstructorInstance : Constructor @@ -40,6 +41,18 @@ public DomConstructorInstance(EngineInstance engine, ConstructorDefinition defin SetOwnProperty("prototype", new PropertyDescriptor(_objectPrototype, false, false, false)); AddStaticMembers(definition.Type.GetStaticMembers()); + AddConstants(engine.Libs.GetConstants(definition.Name)); + } + + private void AddConstants(IEnumerable> constants) + { + foreach (var constant in constants) + { + if (GetOwnProperty(constant.Key) == PropertyDescriptor.Undefined) + { + SetOwnProperty(constant.Key, new PropertyDescriptor(JsNumber.Create(constant.Value), false, true, false)); + } + } } private void AddStaticMembers(StaticMember[] members) diff --git a/src/AngleSharp.Js/Proxies/DomNodeInstance.cs b/src/AngleSharp.Js/Proxies/DomNodeInstance.cs index f5da692..54ccad9 100644 --- a/src/AngleSharp.Js/Proxies/DomNodeInstance.cs +++ b/src/AngleSharp.Js/Proxies/DomNodeInstance.cs @@ -246,11 +246,16 @@ protected override OwnPropertyProbe ProbeOwnProperty(JsValue property) /// private PropertyDescriptor GetGlobalProperty(JsValue property) { - if (_value is IWindow) + if (_value is IWindow window) { - var global = _instance.Jint.Global; - - if (!ReferenceEquals(global, this)) + // Another window (of the same origin, the others are wrapped) has its globals in the + // engine of its own document: a frame calling parent.notify() finds the function + // the parent declared. + var global = ReferenceEquals(_instance.Window?.Value, window) + ? _instance.Jint.Global + : AngleSharp.Scripting.JsScriptingService.TryGetInstance(window)?.Jint.Global; + + if (global != null && !ReferenceEquals(global, this)) { return global.GetOwnProperty(property); } diff --git a/src/Directory.Build.props b/src/Directory.Build.props index fd6785a..09b349d 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -10,7 +10,7 @@ entry of CHANGELOG.md, which build/Build.cs passes in as -p:Version, so this value only affects a plain `dotnet build` and no longer needs bumping for a release. --> - 1.2.2 + 1.2.3