Giter VIP home page Giter VIP logo

htmltextwriter's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

htmltextwriter's Issues

Typo in AddStyleAttribute(string, string) (AddStyleAttrbiute)

The method name AddStyleAttrbiute(string, string) appears to be a typo. Here is a patch to fix it.

diff --git a/Source/HtmlTextWriter/HtmlTextWriter.cs b/Source/HtmlTextWriter/HtmlTextWriter.cs
index ebad04b..a1449a9 100644
--- a/Source/HtmlTextWriter/HtmlTextWriter.cs
+++ b/Source/HtmlTextWriter/HtmlTextWriter.cs
@@ -107,7 +107,9 @@ namespace System.Web.UI
         public void AddStyleAttribute(HtmlTextWriterStyle key, string value) => this.AddStyleAttribute(key, value, true);
         public void AddStyleAttribute(HtmlTextWriterStyle key, string value, bool encode) => AddStyleAttribute(key.ToName(), value, encode);

-        public void AddStyleAttrbiute(string name, string value) => this.AddStyleAttribute(name, value, true);
+        [Obsolete("Typo in method name preserved for binary compatibility. Use the corrected method AddStyleAttribute(string, string).")]
+        public void AddStyleAttrbiute(string name, string value) => this.AddStyleAttribute(name, value);
+        public void AddStyleAttribute(string name, string value) => this.AddStyleAttribute(name, value, true);
         public void AddStyleAttribute(string name, string value, bool encode)
         {
             if (encode)

WriteBeginTag doesn't include end angle bracket

            StringWriter stringWriter = new StringWriter();
            using (HtmlTextWriter writer = new HtmlTextWriter(stringWriter, string.Empty))
            {
                writer.WriteBeginTag("table>");
                writer.WriteBeginTag("tr>");
                writer.WriteBeginTag("th>"); writer.Write("RouteID"); writer.WriteEndTag("th");
                writer.WriteEndTag("tr");
                writer.WriteEndTag("table");
            }

Async method alternatives are missing

In using HtmlTextWriter to write directly to the response stream in asp.net core, those writes need to be async.

HtmlTextWriter does support some async methods to do writes, but it lacks async alternatives for methods like WriteFullBeginTag, WriteEndTag, WriteBeginTag and similar methods.

Writing <TextArea> includes new lines and tabs

For <TextArea> tags, the value of the TextArea is in between the Tags, ex, <TextArea> In a Text area </TextArea>.

The issue is that calling HtmlTextWriter.Write() will always add tabs / new lines after the closing tab, meaning the text area will include those newlines / tabs in the value on the page.

It seems like the .NET HtmlTextWriter only adds tabs when / after calling WriteNewLine(), but, if Write() is only ever called, then no tabs / no newlines would be added.

Recreation steps: Render a <TextArea> tag. Either look at the InnerWriter's value or use jQuery.val() on the rendered element to see that it has tabs / new lines in it.

Requested Functionality: There should be a way to write a value without having tabs/ newlines inserted after a closing tag, >.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.