MCPcopy Create free account
hub / github.com/TruthHun/BookStack / resolveSlots

Function resolveSlots

static/vuejs/vue.esm.js:1941–1972  ·  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

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

Callers 3

updateChildComponentFunction · 0.70
initRenderFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected