From 844d6bd46b293ce07cd2e48d259f6ea2b48e31b6 Mon Sep 17 00:00:00 2001 From: Martin Angers Date: Mon, 24 Feb 2020 18:34:32 -0500 Subject: [PATCH] doc: clarify how RemoveFiltered works --- manipulation.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/manipulation.go b/manipulation.go index 34eb757..b7f2fe5 100644 --- a/manipulation.go +++ b/manipulation.go @@ -212,14 +212,19 @@ func (s *Selection) Remove() *Selection { return s } -// RemoveFiltered removes the set of matched elements by selector. -// It returns the Selection of removed nodes. +// RemoveFiltered removes from the current set of matched elements those that +// match the selector filter. It returns the Selection of removed nodes. +// +// For example if the selection s contains "

", "

" and "

" +// and s.RemoveFiltered("h2") is called, only the "

" node is removed +// (and returned), while "

" and "

" are kept in the document. func (s *Selection) RemoveFiltered(selector string) *Selection { return s.RemoveMatcher(compileMatcher(selector)) } -// RemoveMatcher removes the set of matched elements. -// It returns the Selection of removed nodes. +// RemoveMatcher removes from the current set of matched elements those that +// match the Matcher filter. It returns the Selection of removed nodes. +// See RemoveFiltered for additional information. func (s *Selection) RemoveMatcher(m Matcher) *Selection { return s.FilterMatcher(m).Remove() }