當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript util.encodeAttrName函數代碼示例

本文整理匯總了TypeScript中wed/util.encodeAttrName函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript encodeAttrName函數的具體用法?TypeScript encodeAttrName怎麽用?TypeScript encodeAttrName使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了encodeAttrName函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

 it("on elements inside _phantom_wrap", () => {
   const p =
     guiRoot.querySelector(`.body .p[${encodeAttrName("rend")}='wrap']`)!;
   const dataNode = $.data(p, "wed_mirror_node") as Element;
   const rend = dataNode.getAttribute("rend");
   // Make sure the paragraph has rend="wrap".
   assert.equal(rend, "wrap");
   activateContextMenu(editor, p);
 });
開發者ID:lddubeau,項目名稱:wed,代碼行數:9,代碼來源:wed-menu-test.ts

示例2: DLocRoot

 .then((sourceXML) => {
   root = document.createElement("div");
   document.body.appendChild(root);
   $root = $(root);
   const parser = new window.DOMParser();
   const xmlDoc = parser.parseFromString(sourceXML, "text/xml");
   const htmlTree = convert.toHTMLTree(window.document,
                                       xmlDoc.firstElementChild!);
   root.appendChild(htmlTree);
   rootObj = new DLocRoot(root);
   encodedType = encodeAttrName("type");
 }));
開發者ID:lddubeau,項目名稱:wed,代碼行數:12,代碼來源:dloc-test.ts

示例3: it

  it("dispatch to proper decorators", () => {
    const wrapped =
      editor.guiRoot.querySelectorAll(
        `[${encodeAttrName("rend")}='wrap'].tei\\:p._real`);
    expect(wrapped).to.have.length(2);
    function parentTest(el: HTMLElement, msg: string, expected: boolean): void {
      const parent = el.parentNode as HTMLElement;
      expect(parent.classList.contains("_gui_test"), msg).to.equal(expected);
    }

    parentTest(wrapped[0] as HTMLElement,
               "the first paragraph with rend='wrap' should be decorated by \
the test mode",
               true);
    parentTest(wrapped[1] as HTMLElement,
               "the second paragraph with rend='wrap' should not be decorated \
by the test mode",
               false);
  });
開發者ID:lddubeau,項目名稱:wed,代碼行數:19,代碼來源:wed-submode-test.ts

示例4: it

 it("with qualifier", () => {
   assert.equal(util.encodeAttrName("blah", "ns"), "data-wed--ns-blah-");
 });
開發者ID:lddubeau,項目名稱:wed,代碼行數:3,代碼來源:util-test.ts


注:本文中的wed/util.encodeAttrName函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。