Skip to content

Commit

Permalink
feat: clear used template
Browse files Browse the repository at this point in the history
  • Loading branch information
DIYgod committed Feb 24, 2024
1 parent 653f0db commit 9936fc1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/lib/rsshub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@ import type { RSSData, Rule } from "./types"
const parseHtml = (html) => {
const template = document.createElement('template');
template.innerHTML = html;
return template.content;
return template;
}

function ruleHandler(rule: Rule, params, url, html, success, fail) {
const run = () => {
let resultWithParams
if (typeof rule.target === "function") {
try {
const document = parseHtml(html)
resultWithParams = rule.target(params, url, document)
const template = parseHtml(html)
resultWithParams = rule.target(params, url, template.content)
template.remove()
} catch (error) {
resultWithParams = ""
}
Expand Down

0 comments on commit 9936fc1

Please sign in to comment.