adobe/brackets — pull request #4237 by jasonsanjose (2013-06-14 22:14:26+00:00)
Title: REVIEW ONLY: Basic DOM manipulation via RemoteAgent

Injects jQuery via RemoteAgent. Exposes basic DOM manipulation via ``RemoteAgent.remoteElement(data-brackets-id)``. I used jQuery instead of the Inspector DOM APIs (https://developers.google.com/chrome-developer-tools/docs/protocol/tot/dom) for a few reasons:

* DOM API does not have a method for inserting new elements. The Inspector API can do just about everything else though: attribute CRUD, remove nodes (elements, attributes, text), etc.
* Lessens dependency on Chrome's Inspector API. Injecting jQuery may be desirable in the future for expanded live preview browser support.
* Using jQuery attribute selectors ``$("[data-brackets-id=n]")`` to modify DOM in-browser is easier than maintaining our own DOM tree (see ``DOMAgent`` and ``DOMNode`` modules), calling the DOM API, resolving the ``RemoteObject``, and modifying the ``RemoteObject`` and requires less async calls :)
* Simplifies creation of new DOM elements, e.g.

```
// insert a new sibling before element N
RemoteAgent.remoteElement(N).before(htmlString);
```

Use ``HTMLInstrumentation._getTagIDAtDocumentPos(editor, cursor)`` to get the ``data-brackets-id`` for the given cursor position.