MCPcopy Index your code
hub / github.com/TruthHun/BookStack / resolveSlots

Function resolveSlots

static/vuejs/vue.runtime.esm.js:1937–1968  ·  view source on GitHub ↗

* Runtime helper for resolving raw children VNodes into a slot object.

(
  children,
  context
)

Source from the content-addressed store, hash-verified

1935 * Runtime helper for resolving raw children VNodes into a slot object.
1936 */
1937function resolveSlots (
1938 children,
1939 context
1940) {
1941 var slots = {};
1942 if (!children) {
1943 return slots
1944 }
1945 var defaultSlot = [];
1946 var name, child;
1947 for (var i = 0, l = children.length; i < l; i++) {
1948 child = children[i];
1949 // named slots should only be respected if the vnode was rendered in the
1950 // same context.
1951 if ((child.context === context || child.functionalContext === context) &&
1952 child.data && (name = child.data.slot)) {
1953 var slot = (slots[name] || (slots[name] = []));
1954 if (child.tag === 'template') {
1955 slot.push.apply(slot, child.children);
1956 } else {
1957 slot.push(child);
1958 }
1959 } else {
1960 defaultSlot.push(child);
1961 }
1962 }
1963 // ignore whitespace
1964 if (!defaultSlot.every(isWhitespace)) {
1965 slots.default = defaultSlot;
1966 }
1967 return slots
1968}
1969
1970function isWhitespace (node) {
1971 return node.isComment || node.text === ' '

Callers 3

updateChildComponentFunction · 0.70
initRenderFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected