Autor | Zpráva | ||
---|---|---|---|
tester Profil * |
Mám dvě funkce. Jedna má pomoci najít iframy které obsahují slovo wysiwyg a druhá má pomoci tyto vyloučit:
exclude_wysiwyg = function () { var parent = this; var result = make_it_easy.easy.find_wysiwyg(null, null, parent) return result && result.length ? null : this; } find_wysiwyg = function (a = null, b = null, parent = null) { var current = parent ? parent : this; var result = current.id.match(/wysiwyg/i); if (!result) result = current.className.match(/editable|wysiwyg|editor/i); if (!result) result = current.id.match(/mce/i); if (!result) { if (!current.contentDocument) return null; var success = current.contentDocument.head.innerHTML.match(/editable|wysiwyg|editor|tinymce/i); if ( success && success.length ) return current; success = current.contentDocument.body.innerHTML.match(/editable|wysiwyg|editor|tinymce/i); if ( success && success.length ) return current; } return result; } Najít: iframes = $('iframe').filter(find_wysiwyg); $("iframe").filter(exclude_wysiwyg).remove(); Ta první funkce na nalezení funguje ta druhá na vyloučení a smazání ne. Ta druhá má udělat to že pokud najde wysiwyg tak vrátí iframe ... v tom případě nechci iframe smazat takže vracím null. Pokud iframe nenajde, result je tudiž null, má být vráceno this, tj. iframe který má být smazaný. Testoval jsem to na této stránce: www.zkoss.org/zkdemo/composite/iframe a debugger mi ukazuje že result u exclude_wysiwyg je null tedy má vrátit iframe na smazání. Ale zůstává na stránce. Takže se ptám co mám vrátit do funkce filter aby byla položka smazána? Co dělám špatně? Tak omyl, po bližším prozkoumání zjistil jsem že to funguje dobře, ale že bych měl místo this vracet true. |
||
Časová prodleva: 8 let
|
0