source/index.js
function validate_child_style_class_types(parent_node_names, names)
{
	for (let parent of parent_node_names)
	{
		// if it's a pseudoclass, it can't contain any style classes
		if (is_pseudo_class(parent) && not_empty(names))
		{
			throw new Error(`A style class declaration "${names[0]}" found inside a pseudoclass "${parent}". Pseudoclasses (:hover, etc) can't contain child style classes.`)
		}

		// if it's a media query style class, it must contain only pseudoclasses
		if (is_media_query(parent))
		{
			const non_pseudoclass = names.filter(x => !is_pseudo_class(x))[0]

			if (non_pseudoclass)
			{
				throw new Error(`A non-pseudoclass "${non_pseudoclass}" found inside a media query style class "${parent}". Media query style classes can only contain pseudoclasses (:hover, etc).`)
			}
		}
		
		// if it's a keyframes style class, it must contain only keyframe selectors
		if (is_keyframes(parent)) {
			const non_keyframe_selector = names.filter(x => !is_keyframe_selector(x))[0]

			if (non_keyframe_selector) 
			{
				throw new Error(`A non-keyframe-selector "${non_keyframe_selector}" found inside a keyframes style class "${parent}". Keyframes style classes can only contain keyframe selectors (from, 100%, etc).`);
			}
		}
	}
}
function validate_child_style_class_types(parent_node_names, names)
{
	for (let parent of parent_node_names)
	{
		// if it's a pseudoclass, it can't contain any style classes
		if (is_pseudo_class(parent) && not_empty(names))
		{
			throw new Error(`A style class declaration "${names[0]}" found inside a pseudoclass "${parent}". Pseudoclasses (:hover, etc) can't contain child style classes.`)
		}

		// if it's a media query style class, it must contain only pseudoclasses
		if (is_media_query(parent))
		{
			const non_pseudoclass = names.filter(x => !is_pseudo_class(x))[0]

			if (non_pseudoclass)
			{
				throw new Error(`A non-pseudoclass "${non_pseudoclass}" found inside a media query style class "${parent}". Media query style classes can only contain pseudoclasses (:hover, etc).`)
			}
		}
		
		// if it's a keyframes style class, it must contain only keyframe selectors
		if (is_keyframes(parent)) {
			const non_keyframe_selector = names.filter(x => !is_keyframe_selector(x))[0]

			if (non_keyframe_selector) 
			{
				throw new Error(`A non-keyframe-selector "${non_keyframe_selector}" found inside a keyframes style class "${parent}". Keyframes style classes can only contain keyframe selectors (from, 100%, etc).`);
			}
		}
	}
}
function validate_child_style_class_types ( parent_node_names , names ) { for ( let parent of parent_node_names ) { // if it's a pseudoclass, it can't contain any style classes if ( is_pseudo_class ( parent ) && not_empty ( names ) ) { throw new Error ( ` ${ names [ 0 ] } ${ parent } ` ) } // if it's a media query style class, it must contain only pseudoclasses if ( is_media_query ( parent ) ) { const non_pseudoclass = names . filter ( x => ! is_pseudo_class ( x ) ) [ 0 ] if ( non_pseudoclass ) { throw new Error ( ` ${ non_pseudoclass } ${ parent } ` ) } } // if it's a keyframes style class, it must contain only keyframe selectors if ( is_keyframes ( parent ) ) { const non_keyframe_selector = names . filter ( x => ! is_keyframe_selector ( x ) ) [ 0 ] if ( non_keyframe_selector ) { throw new Error ( ` ${ non_keyframe_selector } ${ parent } ` ) ; } } } }
style class nesting validation
style class nesting validation