1
我想保存一個字符串,如「<div class='some_class'>some content</div>
」,在mongo文檔中,以後,當我獲取此內容時,我想將其轉換到一個DOM節點。Metor:將html保存爲字符串,稍後將其轉換爲DOM節點
如何在將內容添加到DOM並使用流星將其轉換爲DOM節點之前編輯內容?
我想保存一個字符串,如「<div class='some_class'>some content</div>
」,在mongo文檔中,以後,當我獲取此內容時,我想將其轉換到一個DOM節點。Metor:將html保存爲字符串,稍後將其轉換爲DOM節點
如何在將內容添加到DOM並使用流星將其轉換爲DOM節點之前編輯內容?
你可以看看[Cheerio](https://github.com/cheeriojs/cheerio) - 它是一個用於在服務器端操縱DOM的Node包。可以在這裏找到相同版本的氣象版本(https://atmospherejs.com/mrt/cheerio)。 –
我很確定像「某些內容」這樣的字符串,永遠不會是「DOM」。您需要將其包裝在某個HTML標記中,以使其成爲「DOM」 – colecmc