本文整理匯總了C#中SharpKit.Html.HtmlElement.getAttribute方法的典型用法代碼示例。如果您正苦於以下問題:C# HtmlElement.getAttribute方法的具體用法?C# HtmlElement.getAttribute怎麽用?C# HtmlElement.getAttribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SharpKit.Html.HtmlElement
的用法示例。
在下文中一共展示了HtmlElement.getAttribute方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: resolveContent
public void resolveContent(HtmlElement element)
{
var content = element.getAttribute("data-content");
//Clean up any of our properties embedded in the DOM
element.removeAttribute("data-content");
if (content == null) {
//content = map.getExtensionValue("content");
}
//load the content
}
示例2: investigateDomElement
private void investigateDomElement(HtmlElement element, InjectionClassBuilder classBuilder, AbstractBehavior parentBehavior)
{
var currentBehavior = parentBehavior;
var id = element.getAttribute("id");
if (id != null) {
//we have a reference to the element now, so remove the id so we dont have to deal with conflicts and clashes
element.removeAttribute("id");
}
var elementDescriptor = elementDescriptorFactory.describeElement( element );
if (elementDescriptor.context != null) {
//change the class builder for everything under this point in the DOM
classBuilder = domExtensionFactory.buildChildClassBuilder(classBuilder, element, elementDescriptor.context);
}
if (elementDescriptor.behavior != null) {
//build a context for this behavior IF it turns out that this particular element defines one
currentBehavior = domExtensionFactory.buildBehavior( classBuilder, element, elementDescriptor.behavior );
//we have a new behavior, this effectively causes us to use a new context for the nodes below it
//Make sure we add ourselves to our parent though
if (id != null && parentBehavior != null) {
parentBehavior.injectPotentialNode(id, currentBehavior);
}
} else {
if (id != null && currentBehavior != null) {
currentBehavior.injectPotentialNode(id, jQueryContext.J(element));
}
}
if (elementDescriptor.fragment != null) {
//build a context for this behavior IF it turns out that this particular element defines one
domExtensionFactory.buildNewContent(element, elementDescriptor.fragment);
}
walkChildren(element, classBuilder, currentBehavior);
//Now that we have figured out all of the items under this dom element, setup the behavior
if (currentBehavior != null && currentBehavior != parentBehavior) {
currentBehavior.verifyAndRegister();
}
}
示例3: describeElement
public ElementDescriptor describeElement(HtmlElement element )
{
//This is purely an efficiency gain. By making a merged map for this one element, we stop everyone from cycling through
//every class on an element to pull out their own piece of data
var entry = styleExtensionManager.getMergedEntryForElement(element);
var descriptor = new ElementDescriptor {
context = element.getAttribute("data-context"),
behavior = element.hasAttribute("data-mediator") ? element.getAttribute("data-mediator") : element.getAttribute("data-behavior"),
fragment = element.getAttribute("data-fragment"),
formatter = element.getAttribute( "data-formatter" ),
validator = element.getAttribute( "data-validator" )
};
if ( entry != null ) {
if (descriptor.context == null) {
descriptor.context = entry.getExtensionClass("module");
}
if (descriptor.behavior == null) {
//mediator and behavior are really the same thing and hence mutually exclusive
descriptor.behavior = entry.hasExtensionType("mediator")?entry.getExtensionClass("mediator"):entry.getExtensionClass("behavior");
}
if (descriptor.fragment == null) {
descriptor.fragment = entry.getExtensionClass("fragment");
}
if (descriptor.formatter == null) {
descriptor.formatter = entry.getExtensionClass("formatter");
}
if (descriptor.validator == null) {
descriptor.validator = entry.getExtensionClass("validator");
}
}
return descriptor;
}
示例4: JsApiBase
//.........這裏部分代碼省略.........
if (element.dataset != null && dataset["tex"] != null &&
element.innerText.As<JsBoolean>())
{
contents = (element.innerHTML.As<string>()).Trim();
element.innerHTML = "";
}
#region Create context elements (wrapper, canvas etc)
CanvasElement = (HtmlElement)document.createElement("div");
CanvasElement.className = "alphaTabSurface";
CanvasElement.style.fontSize = "0";
element.appendChild(CanvasElement);
#endregion
#region Auto Sizing
AutoSize = settings.Width < 0;
if (AutoSize)
{
settings.Width = element.offsetWidth;
if (options)
{
options.width = element.offsetWidth;
}
int timeoutId = 0;
window.addEventListener("resize", e =>
{
window.clearTimeout(timeoutId);
timeoutId = window.setTimeout(() =>
{
if (element.offsetWidth != settings.Width)
{
var resizeEventInfo = new ResizeEventArgs();
resizeEventInfo.OldWidth = settings.Width;
resizeEventInfo.NewWidth = element.offsetWidth;
resizeEventInfo.Settings = settings;
TriggerEvent("resize", resizeEventInfo);
settings.Width = resizeEventInfo.NewWidth;
Renderer.UpdateSettings(settings);
Renderer.Resize(element.offsetWidth);
}
}, 100);
});
}
#endregion
}
#region Renderer Setup
CreateStyleElement(settings);
if (element != null && AutoSize)
{
var initialResizeEventInfo = new ResizeEventArgs();
initialResizeEventInfo.OldWidth = 0;
initialResizeEventInfo.NewWidth = element.offsetWidth;
initialResizeEventInfo.Settings = settings;
TriggerEvent("resize", initialResizeEventInfo);
settings.Width = initialResizeEventInfo.NewWidth;
}
Renderer = CreateScoreRenderer(settings);
Renderer.RenderFinished += o => TriggerEvent("rendered");
Renderer.PostRenderFinished += () => TriggerEvent("post-rendered");
Renderer.PreRender += result =>
{
CanvasElement.innerHTML = "";
AppendRenderResult(result);
};
Renderer.PartialRenderFinished += AppendRenderResult;
Renderer.RenderFinished += AppendRenderResult;
#endregion
#region Load Default Data
if (!string.IsNullOrEmpty(contents))
{
Tex(contents);
}
else if (options && options.file)
{
Load(options.file);
}
else if (Element != null && Element.dataset != null && !string.IsNullOrEmpty(dataset["file"]))
{
Load(dataset["file"]);
}
else if (Element != null && !string.IsNullOrEmpty(Element.getAttribute("data-file")))
{
Load(Element.getAttribute("data-file"));
}
#endregion
}