diff options
| author | LV-426 <lv-426@taproot.org.il> | 2014-11-13 17:07:22 +0200 |
|---|---|---|
| committer | LV-426 <lv-426@taproot.org.il> | 2014-11-13 17:11:56 +0200 |
| commit | 8fbcbee28c697433f816e1f10353514833c2f360 (patch) | |
| tree | 25ced5bed3a842f3e8c908c7ea10cfb5f36de1b9 | |
| parent | 22c032f9bf222de58c3923f769d67c4274034871 (diff) | |
locate_visual_element() using model object's id
| -rw-r--r-- | scripts/rz_core.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/rz_core.js b/scripts/rz_core.js index e84e9d06..8e4d1a89 100644 --- a/scripts/rz_core.js +++ b/scripts/rz_core.js @@ -119,6 +119,21 @@ var initDrawingArea = function () { initDrawingArea(); +/** + * find the visual element counterpart of a given model object. This relies on + * the visual element having an id attribute equal to the object's id. + * + * @return null if visual element is not found + */ +function locate_visual_element(model_obj){ + var id_sel = $('#' + model_obj.id); + if (0 == id_sel.length){ + console.warn('unable to find visual element for model object: object id: ' + model_obj.id.toString()) + return null; + } + return id_sel[0]; +} + function update(no_relayout) { var node, link, |
