From f3dd28e29444fede643181d866aea04b0bf8a37c Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 27 Sep 2018 12:35:46 -0700 Subject: [PATCH] Add more documentation to `web-sys` constructors Closes #899 --- crates/webidl/src/lib.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/webidl/src/lib.rs b/crates/webidl/src/lib.rs index 6a6d1318..4b2cfb92 100644 --- a/crates/webidl/src/lib.rs +++ b/crates/webidl/src/lib.rs @@ -647,7 +647,13 @@ impl<'src> FirstPassRecord<'src> { } }; let doc = match id { - OperationId::Constructor(_) | OperationId::Operation(None) => Some(String::new()), + OperationId::Operation(None) => Some(String::new()), + OperationId::Constructor(_) => { + Some(format!("The `new {}(..)` constructor, creating a new \ + instance of `{0}`\n\n{}", + self_name, + mdn_doc(self_name, Some(self_name)))) + } OperationId::Operation(Some(name)) => Some(format!( "The `{}()` method\n\n{}", name,