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


TypeScript Attr.get方法代碼示例

本文整理匯總了TypeScript中@ephox/sugar.Attr.get方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Attr.get方法的具體用法?TypeScript Attr.get怎麽用?TypeScript Attr.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@ephox/sugar.Attr的用法示例。


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

示例1: function

const fromLink = function (link) {
  const text = TextContent.get(link);
  const url = Attr.get(link, 'href');
  const title = Attr.get(link, 'title');
  const target = Attr.get(link, 'target');
  return {
    url: defaultToEmpty(url),
    text: text !== url ? defaultToEmpty(text) : '',
    title: defaultToEmpty(title),
    target: defaultToEmpty(target),
    link: Option.some(link)
  };
};
開發者ID:abstask,項目名稱:tinymce,代碼行數:13,代碼來源:LinkBridge.ts

示例2:

        Logger.t('Check if iframe has the right custom attributes', Step.sync(function () {
          const ifr = Element.fromDom(editor.iframeElement);

          Assertions.assertEq('Id should not be the defined x', true, Attr.get(ifr, 'id') !== 'x');
          Assertions.assertEq('Custom attribute whould have the right value', 'a', Attr.get(ifr, 'data-custom1'));
          Assertions.assertEq('Custom attribute whould have the right value', 'b', Attr.get(ifr, 'data-custom2'));
        }))
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:7,代碼來源:InitIframeEditorWithCustomAttrsTest.ts

示例3:

 const getAttr = (c, property: string): Option<any> => {
   if (Attr.has(c, property)) {
     return Option.some(Attr.get(c, property));
   } else {
     return Option.none();
   }
 };
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:7,代碼來源:Identification.ts

示例4: function

const takeoverViewport = function (toolbarHeight, height, viewport) {
  const oldViewportStyle = Attr.get(viewport, 'style');

  Scrollable.register(viewport);
  Css.setAll(viewport, {
    position: 'absolute',
    // I think there a class that does this overflow scrolling touch part
    height: height + 'px',
    width: '100%',
    top: toolbarHeight + 'px'
  });

  Attr.set(viewport, yFixedData, toolbarHeight + 'px');
  Attr.set(viewport, yScrollingData, 'true');
  Attr.set(viewport, yFixedProperty, 'top');

  const restore = function () {
    Scrollable.deregister(viewport);
    Attr.set(viewport, 'style', oldViewportStyle || '');
    Attr.remove(viewport, yFixedData);
    Attr.remove(viewport, yScrollingData);
    Attr.remove(viewport, yFixedProperty);
  };

  return {
    restore
  };
};
開發者ID:abstask,項目名稱:tinymce,代碼行數:28,代碼來源:IosViewport.ts

示例5:

 Step.sync(function () {
   const component = memento.get(realm.socket());
   Assertions.assertEq(
     'Selected/Pressed state of component: (' + Attr.get(component.element(), 'class') + ')',
     state,
     Toggling.isOn(component)
   );
 }),
開發者ID:abstask,項目名稱:tinymce,代碼行數:8,代碼來源:TestUi.ts

示例6:

 const cGetDialogLabelId = Chain.binder((dialogE: Element) => {
   if (Attr.has(dialogE, 'aria-labelledby')) {
     const labelId = Attr.get(dialogE, 'aria-labelledby');
     return labelId.length > 0 ? Result.value(labelId) : Result.error('Dialog has zero length aria-labelledby attribute');
   } else {
     return Result.error('Dialog has no aria-labelledby attribute');
   }
 });
開發者ID:tinymce,項目名稱:tinymce,代碼行數:8,代碼來源:SilverDialogAriaLabelTest.ts

示例7: function

 Arr.each(clobberedEls, function (element) {
   const restore = Attr.get(element, attr);
   if (restore !== 'no-styles') {
     Attr.set(element, 'style', restore);
   } else {
     Attr.remove(element, 'style');
   }
   Attr.remove(element, attr);
 });
開發者ID:abstask,項目名稱:tinymce,代碼行數:9,代碼來源:Thor.ts

示例8: Error

 Chain.op((dialog) => {
   if (Attr.has(dialog, 'aria-labelledby')) {
     const labelledby = Attr.get(dialog, 'aria-labelledby');
     const dialogLabel = SelectorFind.descendant(dialog, '#' + labelledby).getOrDie('Could not find labelledby');
     Assertions.assertEq('Checking label text', ariaLabel, Html.get(dialogLabel));
   } else {
     throw new Error('Dialog did not have an aria-labelledby');
   }
 })
開發者ID:tinymce,項目名稱:tinymce,代碼行數:9,代碼來源:FullScreenPluginTest.ts

示例9:

    (editor: Editor, onSuccess, onFailure) => {
      const replacedElem = Element.fromDom(editor.getElement());

      Pipeline.async({ }, [
        Chain.asStep(Body.body(), [
          UiFinder.cFindIn(`#${Attr.get(replacedElem, 'id')}`),
          Chain.binder((elem) => Traverse.nextSibling(elem).fold(() => Result.error('Replaced element has no next sibling'), Result.value)),
          Chain.mapper((elem) => Class.has(elem, 'tox-tinymce')),
          Assertions.cAssertEq('Replaced element\'s next sibling has "tox-tinymce" class', true)
        ])
      ], onSuccess, onFailure);
    },
開發者ID:tinymce,項目名稱:tinymce,代碼行數:12,代碼來源:ToxWrappingTest.ts


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