Beispiel #1
0
        private void CopyBodyAttributes(string sourceHtml, IHTMLElement destinationBody)
        {
            Debug.Assert(destinationBody != null, "destinationBody should not be null!");
            if (destinationBody == null)
            {
                return;
            }

            var finder = new BodyTagFinder(sourceHtml);

            finder.Parse();
            if (finder.BodyBeginTag != null)
            {
                StringBuilder bodyAttributes = new StringBuilder();
                foreach (Attr attr in finder.BodyBeginTag.Attributes)
                {
                    bodyAttributes.AppendFormat(CultureInfo.InvariantCulture, "{0} ", attr);
                }
                IHTMLElement sourceBodyElement = EditorContext.MarkupServices.CreateElement(_ELEMENT_TAG_ID.TAGID_BODY, bodyAttributes.ToString());
                HTMLElementHelper.CopyAttributes(sourceBodyElement, destinationBody);
            }
        }
        private void CopyBodyAttributes(string sourceHtml, IHTMLElement destinationBody)
        {
            Debug.Assert(destinationBody != null, "destinationBody should not be null!");
            if (destinationBody == null)
            {
                return;
            }

            var finder = new BodyTagFinder(sourceHtml);
            finder.Parse();
            if (finder.BodyBeginTag != null)
            {
                StringBuilder bodyAttributes = new StringBuilder();
                foreach (Attr attr in finder.BodyBeginTag.Attributes)
                {
                    bodyAttributes.AppendFormat(CultureInfo.InvariantCulture, "{0} ", attr);
                }
                IHTMLElement sourceBodyElement = EditorContext.MarkupServices.CreateElement(_ELEMENT_TAG_ID.TAGID_BODY, bodyAttributes.ToString());
                HTMLElementHelper.CopyAttributes(sourceBodyElement, destinationBody);
            }
        }