ispras / web-scraper-chrome-extension

Web data extraction tool implemented as chrome extension
GNU Lesser General Public License v3.0
214 stars 68 forks source link

fixes in updateSelector() #142

Open flamigoalexander opened 3 months ago

flamigoalexander commented 3 months ago

Previously, when changing a selector type, all of its childrens were deleted, even if the new selector type supported child selectors. This change fixes it by creating a copy of the child selectors and adding them as children to the new parent. (TALCR-538)

flamigoalexander commented 3 months ago

I didn't change the deleteSelector method because it works correctly and deletes the parent selector and its childs as it should be. In my opinion, the problem here in the updateSelector method, which uses deleteSelector, although in theory the selector may not be deleted, but an existing one can be changed.

flamigoalexander commented 3 months ago

Also, I must say that my solution has a bug. It keeps the child selectors, but the grandchildren are removed(children's children). I couldn't find an efficient way to cascade through all child selectors. So I think I need some help about this

flamigoalexander commented 3 months ago

I'm also not sure about VAR, but I think that because it has functional variable scope, and is therefore only accessible from the updateSelectror method, this should not cause any major problems

Hat331 commented 2 months ago

What happens if you encounter a selector that is a parent of itself?