Package org.jsoup.nodes

Examples of org.jsoup.nodes.Attributes$Dataset$DatasetIterator


  @Test
  public void defaultsToNonAmdScriptModeWithoutConfig() {
    MockWebPage webPage = new MockWebPage();
    webPage.isDojoScript = true;
   
    Attributes attrs = new Attributes();   
    Element dojoScript = new Element(Tag.valueOf("script"), "", attrs);
   
    assertEquals(ModuleFormat.NON_AMD, webPage.moduleFormat);
    webPage.parsePreDojoScript(dojoScript);
    assertEquals(ModuleFormat.NON_AMD, webPage.moduleFormat);
View Full Code Here


  @Test
  public void disablesAmdScriptParsingWithConfigAttrOnScriptTag() {
    MockWebPage webPage = new MockWebPage();
    webPage.isDojoScript = true;
   
    Attributes attrs = new Attributes();
    attrs.put("data-dojo-config", "async: false");   
   
    Element dojoScript = new Element(Tag.valueOf("script"), "", attrs);
    webPage.parsePreDojoScript(dojoScript);
    assertEquals(ModuleFormat.NON_AMD, webPage.moduleFormat);
  }
View Full Code Here

  @Test
  public void enablesAmdScriptParsingWithConfigAttrOnScriptTag() {
    MockWebPage webPage = new MockWebPage();
    webPage.isDojoScript = true;
   
    Attributes attrs = new Attributes();
    attrs.put("data-dojo-config", "async: true");   
   
    Element dojoScript = new Element(Tag.valueOf("script"), "", attrs);
    webPage.parsePreDojoScript(dojoScript);
    assertEquals(ModuleFormat.AMD, webPage.moduleFormat);
  }
View Full Code Here

  @Test
  public void enablesAmdScriptParsingWithOldConfigAttrOnScriptTag() {
    MockWebPage webPage = new MockWebPage();
    webPage.isDojoScript = true;
   
    Attributes attrs = new Attributes();
    attrs.put("djconfig", "async: true");   
   
    Element dojoScript = new Element(Tag.valueOf("script"), "", attrs);
    webPage.parsePreDojoScript(dojoScript);
    assertEquals(ModuleFormat.AMD, webPage.moduleFormat);
  }
View Full Code Here

  @Test
  public void enablesAmdScriptParsingWithLocalConfigInScriptTag() {
    MockWebPage webPage = new MockWebPage();
    webPage.scriptContents = "var dojoConfig = { async : true }";
   
    Attributes attrs = new Attributes();   
    Element dojoScript = new Element(Tag.valueOf("script"), "", attrs);
   
    webPage.parsePreDojoScript(dojoScript);
    assertEquals(ModuleFormat.AMD, webPage.moduleFormat);
   
View Full Code Here

  @Test
  public void enablesAmdScriptParsingWithGlobalConfigInScriptTag() {
    MockWebPage webPage = new MockWebPage();
    webPage.scriptContents = "dojoConfig = { async : true }";
   
    Attributes attrs = new Attributes();   
    Element dojoScript = new Element(Tag.valueOf("script"), "", attrs);
   
    webPage.parsePreDojoScript(dojoScript);
    assertEquals(ModuleFormat.AMD, webPage.moduleFormat);
   
View Full Code Here

    RemoteWebPage webPage = new RemoteWebPage(document, new URL("http://localhost/"), new MockHttpClient());   
   
    // Create inline script tag...
    String scriptContents = getResourceAsString("sample_module_libs/non_amd/simple_deps/app.js");
    Attributes attrs = new Attributes();
    Element inlineScript = new Element(Tag.valueOf("script"), "", attrs);       
    document.appendChild(inlineScript);   
    inlineScript.html(scriptContents);
   
    String comparison = StringEscapeUtils.unescapeHtml(webPage.retrieveScriptContents(inlineScript));   
View Full Code Here

    RemoteWebPage webPage = new RemoteWebPage(document, new URL("http://localhost/"), mockHttpClient);   
   
    // Create inline script tag...
    String scriptContents = getResourceAsString("sample_module_libs/non_amd/simple_deps/app.js");
    Attributes attrs = new Attributes();
    attrs.put("src", "app.js");   
    Element inlineScript = new Element(Tag.valueOf("script"), "http://localhost/", attrs);           
   
    // Set pre-canned response
    mockHttpClient.hostPrefix = "http://localhost/";
    mockHttpClient.appDir = "sample_module_libs/non_amd/simple_deps/";    
View Full Code Here

      tq.addFirst("<");
      parseTextNode();
      return;
    }

    Attributes attributes = new Attributes();
    while (!tq.matchesAny("<", "/>", ">") && !tq.isEmpty()) {
      Attribute attribute = parseAttribute();
      if (attribute != null)
        attributes.put(attribute);
    }

    Tag tag = Tag.valueOf(tagName);
    // TODO - option to create elements without indent
    Element child = new Element(tag, baseUri, attributes);
View Full Code Here

        }
        return false;
    }

    Attributes getEnforcedAttributes(String tagName) {
        Attributes attrs = new Attributes();
        TagName tag = TagName.valueOf(tagName);
        if (enforcedAttributes.containsKey(tag)) {
            Map<AttributeKey, AttributeValue> keyVals = enforcedAttributes.get(tag);
            for (Map.Entry<AttributeKey, AttributeValue> entry : keyVals.entrySet()) {
                attrs.put(entry.getKey().toString(), entry.getValue().toString());
            }
        }
        return attrs;
    }
View Full Code Here

TOP

Related Classes of org.jsoup.nodes.Attributes$Dataset$DatasetIterator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.