mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Elements tab support for iOS Chrome DevTools (#4930)
* add initial implementation of the dom agent for ios * add implementation of the css agent for ios * refactor devtools inspector methods to somewhat accomodate ios and android patch elements dom-node tests to test for ios too * fix android dom-node test * fix ios dom-node-tests to mock the ios devtools inspector properly * fix: minor changes
This commit is contained in:
30
tns-core-modules/debugger/devtools-elements.android.ts
Normal file
30
tns-core-modules/debugger/devtools-elements.android.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { InspectorEvents, InspectorCommands } from "./devtools-elements";
|
||||
import { getDocument, getComputedStylesForNode, removeNode, setAttributeAsText } from "./devtools-elements.common";
|
||||
import { registerInspectorEvents, DOMNode } from "./dom-node";
|
||||
|
||||
export function attachDOMInspectorEventCallbacks(DOMDomainFrontend: InspectorEvents) {
|
||||
registerInspectorEvents(DOMDomainFrontend);
|
||||
|
||||
const originalChildNodeInserted: (parentId: number, lastId: number, node: string | DOMNode) => void = DOMDomainFrontend.childNodeInserted;
|
||||
|
||||
DOMDomainFrontend.childNodeInserted = (parentId: number, lastId: number, node: DOMNode) => {
|
||||
originalChildNodeInserted(parentId, lastId, JSON.stringify(node.toObject()));
|
||||
}
|
||||
}
|
||||
|
||||
export function attachDOMInspectorCommandCallbacks(DOMDomainBackend: InspectorCommands) {
|
||||
DOMDomainBackend.getDocument = () => {
|
||||
return JSON.stringify(getDocument());
|
||||
};
|
||||
|
||||
DOMDomainBackend.getComputedStylesForNode = (nodeId) => {
|
||||
return JSON.stringify(getComputedStylesForNode(nodeId));
|
||||
};
|
||||
|
||||
DOMDomainBackend.removeNode = removeNode;
|
||||
DOMDomainBackend.setAttributeAsText = setAttributeAsText;
|
||||
}
|
||||
|
||||
export function attachCSSInspectorCommandCallbacks(CSSDomainFrontend: InspectorCommands) {
|
||||
// no op
|
||||
}
|
||||
Reference in New Issue
Block a user