Mergely seems to rely heavily on global id's when doing its searches for elements, however, from a brief glance, I believe the first interaction is on the element itself.
Also, I believe, though I'm not that familiar with jQuery, that its query language supports some form of searching beneath an element (rather than the entire document).
Short of that, however, would it be possible to make all searches relative to the top element rather than requiring global/document-level id's so it could be used within another polymer element or any shadow-dom element?