Context:
I continue to conduct tests on the composition of web components in different contexts. See Accessing the parent context of a web component that is a DOM or Shadow DOM for more information . In this case, I include in my test entry points in the search space.
Problem:
Suppose we have several instances of the element <x-target>we are trying to find. The points from which those should be located <x-target>will be the elements <x-searcher>. The search process is designed to follow the rule of closest nested volume, typical of compiler theory. That is, each tag <x-searcher>searches <x-target>in each scope, and if it is found, it will be returned, but otherwise it will rise to the parent area, and the search will be repeated to the root, whether in the template or in the document.
Consider the following piece of pseudocode. In my previous post mentioned in context, Scott Miles made a suggestion that inspired me to solve my problem in a similar context. This problem was essentially the same as this one, but instead of using the insertion point for <x-searcher>in-place (A), it literally included this tag. In this context, the behavior <x-searcher>was as expected. The tag received the tag <x-target> id='2'. However, in this context, using insertion points, the element obtained by <x-searcher>, inserted in (A), returns the tag <x-target>with id='1'. It seems that the search process with insertion points is performed in the place where it <x-searcher>lives, and not inside the template where it is inserted.
<x-target id="1">
<x-wrapper>
<x-searcher>
</x-wrapper>
<polymer-element name="x-wrapper">
<template>
<x-target id="2">
<content select="x-searcher"></content>
</template>
</polymer-element>
<polymer-element name="x-searcher">
<template>
...
</template>
<script>
Polymer ('wc-searcher', {
...
search: function () {
a while-based search suggested by Scott Miles in the referred post
}
});
</script>
</polymer-element
Question:
- - , ?
, .