Reputation: 19
I am facing an issue with css property. Let me explain the flow, I am getting the style from api , and implementing it inline on the html. This html including the style is being scanned on backend and the html is captured.At the time of html capturing font-size property is being removed.And rest all the other property works fine.
I am using chromedp package to capture the html in go language, using the following code
func main() {
url := "url_from_where_you want to capture html"
componentSelector := "#root"
html := CaptureHtml(url, componentSelector)
fmt.Println(html)
return
}
func CaptureHtml(url string, componentSelector string) (template.HTML, error) {
ctx, cancel := chromedp.NewContext(context.Background())
defer cancel()
err := chromedp.Run(ctx, chromedp.Navigate(url), chromedp.WaitVisible(componentSelector, chromedp.ByQuery))
if err != nil {
fmt.Println(err)
return "", err
}
// Sleep to ensure the data rendering is complete
time.Sleep(2 * time.Second)
var htmlContent string
// Capture the HTML content of the element containing the rendered API data
err = chromedp.Run(ctx, chromedp.OuterHTML(componentSelector, &htmlContent, chromedp.NodeVisible))
if err != nil {
fmt.Println(err)
}
return template.HTML(htmlContent), err
}
What could be the reason of a particular css property being removed?
Upvotes: 1
Views: 100