From d963787f7fb7da40147adcf215c75785694f6942 Mon Sep 17 00:00:00 2001 From: michael Date: Sat, 30 Jun 2018 08:33:43 +0000 Subject: [PATCH] * Added MutationObserver declaration --- packages/rtl/web.pas | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/packages/rtl/web.pas b/packages/rtl/web.pas index 4e4baa2..890eaa5 100644 --- a/packages/rtl/web.pas +++ b/packages/rtl/web.pas @@ -2793,6 +2793,47 @@ Type property shiftKey : Boolean read FShiftKey; end; + { MutationObserver } + + TJSMutationObserver = Class; + + TJSMutationRecord = record + type_ : string; + target : TJSNode; + addedNodes : TJSNodeList; + removedNodes : TJSNodeList; + previousSibling : TJSNode; + nextSibling : TJSNode; + attributeName : String; + attributeNamespace : String; + oldValue : String; + end; + + TJSMutationRecordArray = array of TJSMutationRecord; + TJSMutationCallback = reference to procedure(mutations: TJSMutationRecordArray; observer: TJSMutationObserver); + + TJSMutationObserverInit = record + attributes: boolean; + attributeOldValue: boolean; + characterData: boolean; + characterDataOldValue: boolean; + childList: boolean; + subTree: boolean; + attributeFilter: TJSArray; + end; + + TJSMutationObserver = class external name 'MutationObserver' (TJSObject) + public + { constructor } + constructor new(mutationCallback: TJSMutationCallback); + { public methods } + procedure observe(target: TJSNode); overload; + procedure observe(target: TJSNode; options: TJSMutationObserverInit); overload; + procedure observe(target: TJSNode; options: TJSObject); overload; + procedure disconnect; + function takeRecords: TJSMutationRecordArray; + end; + var document : TJSDocument; external name 'document';